pretty cool :)
在 2017年05月31日 17:46, Thomas Schmitt 写道:
Hi,
i am now pondering over function grub2_mkisofs in Grub.pm (lacking much experience with Perl, i fear).
Do i get it right that this code looks for the shell script variant of grub-mkrescue and prepares for having xorriso re-start mkisofs emulation after it was ended by the "--" part of "--$opt -f" ?
my $opt = ''; open(A, $fp) && do { $opt = " -as mkisofs" if <A> =~ /^#! +/.+sh/; close A; }; my $cmd = "$mkr --output="$isofilename" $dir ". join(' ', @morefiles)." --$opt -f";
If the script is detected, then grub-mkrescue will get arguments equivalent to this pseudo shellcode:
--output="$isofilename" "$dir" -- -as mkisofs -f
whereas the binary grub-mkrescue gets
--output="$isofilename" "$dir" -- -f
which is wrong in case of the modern released binary version.
Although i really do not like the gesture "-- -as mkisofs", this would be the place to test for the modern released binary and to treat it like the old shell script variant.
My proposal is nevertheless to issue "--" only for the intermediate incompatible binary version. I.e. something like
my $opt = '--'; open(A, $fp) && do { $opt = "" if <A> =~ /^#! +/.+sh/; close A; };
# >>> test for modern released binary version and if so: $opt = ""
my $cmd = "$mkr --output="$isofilename" $dir ". join(' ', @morefiles)." $opt -f";
or
my $opt = ''
# >>> test for intermediate unreleased binary version and if so: $opt = "--"
my $cmd = "$mkr --output="$isofilename" $dir ". join(' ', @morefiles)." $opt -f";
Testing for the unreleased version might be more reliable, because this one is not supposed to change its signatures any more.
I understand that the programmer of Grub.pm expected grub-mkrescue to go on with its incompatible CLI change, whereas GRUB developers decided to rather fix the unintended incompatibility before next release. This release has happened meanwile. So _now_ the behavior is supposed to be stable and deviations are to be considered bugs.
Have a nice day :)
Thomas