Go to file
Lukas Czerner 18ebcf26f4 e2fsprogs: fix device name parsing to resolve names containing '='
Currently in varisous e2fsprogs tools, most notably tune2fs and e2fsck
we will get the device name by passing the user provided string into
blkid_get_devname(). This library function however is primarily intended
for parsing "NAME=value" tokens. It will return the device matching the
specified token, NULL if nothing is found, or copy of the string if it's
not in "NAME=value" format.

However in case where we're passing in a file name that contains an
equal sign blkid_get_devname() will treat it as a token and will attempt
to find the device with the match. Likely finding nothing.

Fix it by checking existence of the file first and then attempt to call
blkid_get_devname(). In case of a collision, notify the user and
automatically prefer the one returned by blkid_get_devname(). Otherwise
return either the existing file, or NULL.

We do it this way to avoid some existing file in working directory (for
example LABEL=volume-name) masking an actual device containing the
matchin LABEL. User can specify full, or relative path (e.g.
./LABEL=volume-name) to make sure the file is used instead.

Link: https://lore.kernel.org/r/20220812130122.69468-1-lczerner@redhat.com
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Daniel Ng <danielng@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-08-12 22:32:14 -04:00
config config: update config.{guess,sub} 2021-08-15 10:36:28 -04:00
contrib setup-schroot: install the udev and systemd packages separately 2022-01-04 00:02:22 -05:00
debian debian: suppress the no-debian-changes lintian warning 2022-01-01 16:06:41 -05:00
debugfs debugfs: make blocksize be unsigned in logdump.c 2022-08-12 15:15:14 -04:00
doc Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
e2fsck e2fsprogs: fix device name parsing to resolve names containing '=' 2022-08-12 22:32:14 -04:00
ext2ed Change "filesystem" to "file system" in the man pages 2021-08-15 19:36:06 -04:00
include libext2fs: code adaptation to use the Windows IO manager 2021-03-31 16:09:14 -04:00
install-utils Remove Changelog files since they're not used after the git migration 2007-07-08 08:50:41 -04:00
lib e2fsprogs: fix device name parsing to resolve names containing '=' 2022-08-12 22:32:14 -04:00
misc e2fsprogs: fix device name parsing to resolve names containing '=' 2022-08-12 22:32:14 -04:00
po Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
resize Avoid potential NULL dereference when argv[0] 2022-08-11 23:49:14 -04:00
scrub Change "filesystem" to "file system" in the man pages 2021-08-15 19:36:06 -04:00
tests resize2fs: open device read-only when -P is passed 2022-08-11 10:39:48 -04:00
util libext2fs: code adaptation to use the Windows IO manager 2021-03-31 16:09:14 -04:00
.gitignore misc: add e2mmpstatus utility via dumpe2fs 2018-06-22 18:22:37 -04:00
.missing-copyright Many files: 1997-04-29 16:15:03 +00:00
.release-checklist Update release notes, etc., for the 1.46.2 release 2021-02-28 21:46:44 -05:00
ABOUT-NLS Update gettext files to version 0.19.8 2020-11-25 11:55:46 -05:00
acinclude.m4 configure: don't fail if /usr/include/sys/mount.h does not exist 2019-11-13 13:55:29 -05:00
aclocal.m4 Update configure/configure.ac/aclocal.m4 to use autoconf 2.71 2022-08-07 19:49:33 -04:00
Android.bp AOSP: Move system_shared_libs into target.bionic clause 2021-07-27 12:31:55 -04:00
CleanSpec.mk AOSP: e2fsdroid and mke2fs are dynamic executable in recovery partition 2018-06-27 23:51:40 -04:00
configure Build the fuzzers from oss-fuzz 2022-08-09 19:45:07 -04:00
configure.ac Build the fuzzers from oss-fuzz 2022-08-09 19:45:07 -04:00
depfix.sed Build the fuzzers from oss-fuzz 2022-08-09 19:45:07 -04:00
e2fsprogs.lsm Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
e2fsprogs.spec Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
INSTALL Fix typos in code comments and developer docs 2017-10-15 23:00:11 -04:00
INSTALL.elfbin Fix typos in code comments and developer docs 2017-10-15 23:00:11 -04:00
Makefile.in Build the fuzzers from oss-fuzz 2022-08-09 19:45:07 -04:00
MCONFIG.in Build the fuzzers from oss-fuzz 2022-08-09 19:45:07 -04:00
NOTICE e2fsprogs: fix Free Software Foundation address 2018-04-19 11:39:09 -04:00
README Update release notes, etc., for the 1.46.4-rc1 release 2021-08-15 21:07:32 -04:00
RELEASE-NOTES Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
SHLIBS Many files: 1997-04-29 16:15:03 +00:00
SUBMITTING-PATCHES Added SUBMITTING-PATCHES file 2005-07-05 22:30:13 -05:00
version.h Update release notes, etc., for the 1.46.5 release 2021-12-30 00:54:33 -05:00
wordwrap.pl Fix wordwrap.pl so it is more portable 2012-09-21 12:50:04 -04:00

	This is the new version (1.46.4) of the second extended file
system management programs.

	From time to time, I release new versions of e2fsprogs, to fix
bugs and to make the utilities more robust.  You can always find
information about the latest version at the the e2fsprogs web page,
which is:

	http://e2fsprogs.sourceforge.net

	The INSTALL file has instructions on building and installing
e2fsprogs.  Provisions for building Red Hat RPMs and Debian dpkg files
are supplied as well.

	In case of bugs in these programs, please contact Ted Ts'o at
tytso@mit.edu or tytso@alum.mit.edu.  See the e2fsck man page for
suggestions of what sort of information to include when submitting bug
reports for these programs.