Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 500089 Details for
Bug 585006
syslinux's isohybrid utility creates ISOs that don't conform to ISO 9660 standard (incorrect Volume Space Size), affects Fedora's netinst and live images
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
iso-image-analyzer.pl
iso-image-analyzer.pl (text/plain), 5.54 KB, created by
Steve Tyler
on 2011-05-20 16:30:46 UTC
(
hide
)
Description:
iso-image-analyzer.pl
Filename:
MIME Type:
Creator:
Steve Tyler
Created:
2011-05-20 16:30:46 UTC
Size:
5.54 KB
patch
obsolete
>#!/usr/bin/perl > ># usage: iso-image-analyzer.pl iso-image-file ... ># ># Extract data from ISO 9660 disc images ># Format as a table with colon-separated fields for import into a spreadsheet ># First row has column names ># Writes to standard output ># Requires isoinfo command ("isoinfo -d -i x.iso") > >use strict; >use warnings; > >use File::Basename; >use File::stat qw(:FIELDS); >use Fcntl qw(O_RDONLY SEEK_SET); >use POSIX qw(strftime); > >my $myname = basename $0; > >my $debug = 0; > >my $isoinfo_prog_path = '/usr/bin/isoinfo'; > >my $field_delimiter = ':'; > >my @report_fields = ( > 'rec_num', # record number > 'file_name', # file name as given on command line > 'vol_id', # volume id > > 'lbs', # logical block size in bytes > 'vol_sz_bks', # volume size in logical blocks > 'vol_sz_b', # volume size in bytes (lbs * vol_sz_bks) > > 'img_sz_b', # image size in bytes > 'img_sz_mib', # image size in MiB (img_sz_b/1024**2) > 'img_mtime', # image modification time (mtime) > 'img_mtime_h', # image modification time (mtime), human readable, GMT > > 'md5sum', # whether the image has an md5sum (0 or 1) > 'isolinux', # whether isolinux was found in boot sector (0 or 1) >); > ># Tags extracted from "isoinfo -d -i x.iso" output. >my %isoinfo_tags = ( > qr/CD-ROM is in ISO 9660 format[ ]*/ => 'format', > qr/Volume id:[ ]*/ => 'vol_id', > qr/Logical block size is:[ ]*/ => 'lbs', > qr/Volume size is:[ ]*/ => 'vol_sz_bks' >); > >sub usage { > print "usage: $myname iso-image-file ...\n"; > exit 0; >} > >sub write_header { > print join($field_delimiter, @report_fields), "\n"; >} > >sub parse_line { > my $line = shift; > my ($field_name, $field_value) = ("", ""); > > foreach my $k (keys %isoinfo_tags) { > if ($line =~ $k) { > $field_name = $isoinfo_tags{$k}; > $field_value = $line; > $field_value =~ s/$k//; # strip tag > $field_value =~ s/[ ]+$//; # strip trailing whitespace > last; > } > } > > return ($field_name, $field_value); >} > ># Search for a pattern in a specified section of a file. ># $rex is a regular expression ># $start is the start position in the file ># $num_bytes is the number of bytes to read >sub grep_image { > my ($file_name, $rex, $start, $num_bytes) = @_; > > print "grep_image: $file_name, '$rex', $start, $num_bytes\n" if $debug; > > sysopen my $fh, $file_name, O_RDONLY or die "$myname: sysopen $file_name: $!"; > binmode $fh; > sysseek $fh, $start, SEEK_SET or die "$myname: sysseek $file_name: $!"; > my $num_read = sysread $fh, my $buf, $num_bytes or die "$myname: sysread $file_name: $!"; > close $fh or die "$myname: sysclose $file_name: $!"; > > print " num_read: $num_read\n" if $debug; > $num_read == $num_bytes or die "$myname: grep_image: $file_name: Read only $num_read bytes, expected $num_bytes bytes\n"; > > my $has_matches = 0; > $has_matches = 1 if $buf =~ $rex; > print " has_matches: $has_matches\n" if $debug; > > return $has_matches; >} > >sub analyze_image { > my $file_name = shift; > print "\nanalyze_image: $file_name\n" if $debug; > > -r $file_name or die "$myname: $file_name is not readable.\n"; > open my $isoinfo_fh, "$isoinfo_prog_path -d -i $file_name |" or die "$myname: Cannot open $isoinfo_prog_path: $!\n"; > > my $line_num = 0; > my %fields = ('file_name' => $file_name); > while (<$isoinfo_fh>) { > chomp; > my $line = $_; > > $line_num++; > printf("%2d: $line\n", $line_num) if $debug; > > my ($field_name, $field_value) = parse_line $line; > print " $field_name: '$field_value'\n" if $field_name && $debug; > $fields{$field_name} = $field_value; > } > > # NB: $fields{'format'} is an empty string. > exists($fields{'format'}) or die "$myname: $file_name is not an ISO image file.\n"; > > exists($fields{'lbs'}) && exists($fields{'vol_sz_bks'}) or die "$myname: Cannot compute 'vol_sz_b'\n"; > $fields{'vol_sz_b'} = $fields{'lbs'} * $fields{'vol_sz_bks'}; > > my $st = stat($file_name) or die "Cannot stat $file_name: $!\n"; > $fields{'img_sz_b'} = $st->size; > $fields{'img_sz_mib'} = sprintf("%.8f", $st->size / 1024**2); > $fields{'img_mtime'} = $st->mtime; > $fields{'img_mtime_h'} = strftime("%F %T", gmtime($st->mtime)); > > $fields{'md5sum'} = grep_image($file_name, qr/ISO MD5SUM/, 0x8000, 0x1000); > $fields{'isolinux'} = grep_image($file_name, qr/isolinux\.bin/, 0, 512); > > return \%fields; >} > >sub write_record { > my $fields = shift; > my $rec_num = $fields->{'rec_num'}; > > print "write_record: $rec_num\n" if $debug; > > my @record; > foreach my $f (@report_fields) { > my $val = 'null'; # value for unknown fields > $val = $fields->{$f} if exists($fields->{$f}); > push @record, $val; > print " $f: \"$val\"\n" if $debug; > } > > foreach my $f (@record) { > # Gnumeric treats double-quoted text as a one field and > # doubled double-quotes are interpreted as a single double-quote. > # Setting $field_delimiter to '"' is not a good idea. > $f =~ s/"/""/g; > $f = '"' . $f . '"' if $f =~ qr/[ $field_delimiter]/; > } > > print join($field_delimiter, @record), "\n"; >} > >@ARGV or usage; > >-x $isoinfo_prog_path or die "$myname: $isoinfo_prog_path is not executable.\n" ; > >if ($debug && 0) { > foreach my $k (keys %isoinfo_tags) { > print "$myname: '", $k, "' => '", $isoinfo_tags{$k}, "'\n"; > } >} > >write_header; > >my $rec_num = 0; >foreach (@ARGV) { > $rec_num++; > my $fields = analyze_image $_; > $fields->{'rec_num'} = $rec_num; > write_record $fields; >} > >exit 0; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 585006
: 500089