Hi Niels, Niels Thykier <niels@thykier.net> writes: >> sub check_init_script { >> my ($pkg, $info, $file) = @_; >> >> my $lsb_source_seen; >> my $path = $info->index ($file); >> fail "$file is neither a regular file nor a resolvable symlink" >> unless ($path->is_regular_file || defined($path->link_resolved)); >> open(my $fh, '<', $info->unpacked($file)) >> or fail "cannot open $file: $!"; >> >> # … >> } >> >> Does that seem alright to you? >> > > Almost; it definitely plugs the issues I mentioned. That said, I > believe we prefer to emit tags instead of erroring out when we see an > unexpected file type (e.g. see control-file-is-not-a-file). > Secondly, there is a bug in that link_resolved is only applicable to > links. So if it is not a regular file and not a link, the code will > croak in $path->link_resolved[2]. Okay, so how about this? sub check_init_script { my ($pkg, $info, $file) = @_; my $lsb_source_seen; my $path = $info->index ($file); unless ($path->is_regular_file || ($path->is_symlink && defined($path->link_resolved))) { tag 'init-script-is-not-a-file', $file; } open(my $fh, '<', $info->unpacked($file)) or fail "cannot open $file: $!"; # … } > It really looks like a implementation of Text::ParseWords's > shellwords[3]. If so, we can get that entire sub as a oneliner (we > already use Text::ParseWords elsewhere). I switched to shellwords. We can always rever to the code we’ve had before, but in my tests, shellwords works fine. Find the new files attached. -- Best regards, Michael
Attachment:
systemd
Description: Binary data
Attachment:
systemd.desc
Description: Binary data