Skip to content

Commit ddc35c7

Browse files
authored
rm: raise error for long options (#632)
* I noticed that if I provide "long" options to rm, it gets confused and attempts to remove files starting with a dash * When debugging this, preprocess_options() was incorrectly deciding to save long options into new_args list; call usage() instead because this rm only supports single letter options %perl rm --this # before patch rm: cannot remove '-t': No such file or directory rm: cannot remove '-h': No such file or directory rm: cannot remove '-i': No such file or directory rm: cannot remove '-s': No such file or directory
1 parent a9adcbf commit ddc35c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bin/rm

+6
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ sub preprocess_options {
134134
@rest = @new_args[ $args{'--'} .. $#new_args ];
135135
@new_args = @new_args[0 .. ($args{'--'} - 1)];
136136
}
137+
foreach (@new_args) {
138+
if (m/\A\-\-/) {
139+
warn "unknown option: '$_'\n";
140+
usage();
141+
}
142+
}
137143

138144
# Expand clustering
139145
@new_args = map {

0 commit comments

Comments
 (0)