Skip to content

Commit

Permalink
chgrp: '--' option terminator
Browse files Browse the repository at this point in the history
* chgrp does not use getopt() but it had code to handle the special argument '--' which indicates the end of options
* The handling of '--' was incorrect because ARGV list is already shfted into $opt, but the non-option argument after '--' was shifted too
* With this patch I can do: perl chgrp -- user0 dir1/
* Found this when testing against GNU chgrp
  • Loading branch information
mknos authored Nov 21, 2023
1 parent 231b9d4 commit 29414eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/chgrp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ my %options;
while (@ARGV && $ARGV [0] =~ /^-/) {
my $opt = reverse shift;
chop $opt;
if ($opt eq '-') {shift; last;}
last if ($opt eq '-');
usage() unless $opt =~ /^[RHLP]+$/;
local $_;
while (length ($_ = chop $opt)) {
Expand Down

0 comments on commit 29414eb

Please sign in to comment.