]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
whereis: do not strip suffixes
authorSamanta Navarro <ferivoz@riseup.net>
Wed, 4 Nov 2020 11:37:00 +0000 (11:37 +0000)
committerSamanta Navarro <ferivoz@riseup.net>
Wed, 4 Nov 2020 11:43:09 +0000 (11:43 +0000)
The whereis implementations of FreeBSD, macOS, NetBSD, and OpenBSD do
not strip suffixes. Although whereis is not a POSIX tool and has no
shared standard, even its manual page indicates that the supplied names
are command names.

Commands do not have a suffix on Linux systems.

Stripping suffixes actually leads to issues with tools like fsck.ext4,
since fsck.ext4 is not the same tool as fsck and definitely not the same
tool as fsck.minix.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
misc-utils/whereis.1
misc-utils/whereis.c

index 08e351cec2bc54c036872b8d9a0d2a7fbc7da45f..2ecc70f21d94d7837fcb3f322af3eb7e941ed72e 100644 (file)
@@ -42,11 +42,7 @@ whereis \- locate the binary, source, and manual page files for a command
 .SH DESCRIPTION
 .B whereis
 locates the binary, source and manual files for the specified command names.
-The supplied names are first stripped of leading pathname components and any
-(single) trailing extension of the form
-.BI . ext
-(for example:
-.BR .c )
+The supplied names are first stripped of leading pathname components.
 Prefixes of
 .B s.
 resulting from use of source code control are also dealt with.
index e3e480bdc2c8c3e15a2bca889f2ece1e9b26dbd1..d94e25a58d8cb6df27ddf493f37c86df358da9da 100644 (file)
@@ -469,9 +469,6 @@ static void lookup(const char *pattern, struct wh_dirlist *ls, int want)
                                want & BIN_DIR ? "bin" : "",
                                want & MAN_DIR ? "man" : "",
                                want & SRC_DIR ? "src" : ""));
-       p = strrchr(patbuf, '.');
-       if (p)
-               *p = '\0';
 
        if (!uflag)
                /* if -u not specified then we always print the pattern */