GNU bug report logs -
#10363
/etc/mtab -> /proc/mounts symlink affects df(1) output for /
Previous Next
Reported by: jidanni <at> jidanni.org
Date: Sun, 25 Dec 2011 00:44:02 UTC
Severity: normal
Tags: fixed
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 12/29/11 06:09, Jim Meyering wrote:
> + /* If dev_name is a long-named symlink like
> + /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66 and its
> + canonical name is shorter, use the shorter name. But don't bother
> + checking when DEV_NAME is no longer than e.g., "/dev/sda1" */
> + if (resolve_device_symlink && 9 < orig_len
> + && (resolved_dev = canonicalize_filename_mode (dev_name, CAN_EXISTING)))
> + {
> + if (strlen (resolved_dev) < orig_len)
> + {
> + free (dev_name);
> + dev_name = resolved_dev;
> + }
> + else
> + {
> + free (resolved_dev);
> + }
> + }
I have some qualms about that "is shorter" part;
couldn't that lead to confusing results, on systems
where the canonical name is sometimes a bit shorter and sometimes
a bit longer?
Also, that "9 < orig_len" could also cause confusion.
The flag "resolve_device_symlink" suggests that
the name should always be resolved, at any rate.
In short, how a simpler approach, that always resolves
symlinks? Something like this:
/* If dev_name is a symlink use the resolved name.
On recent GNU/Linux systems we often see a symlink from, e.g.,
/dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66
tp /dev/sda3 and it's better to output /dev/sda3. */
if (resolve_device_symlink
&& (resolved_dev = canonicalize_filename_mode (dev_name, CAN_EXISTING)))
{
free (dev_name);
dev_name = resolved_dev;
}
This bug report was last modified 6 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.