git-AT_NO_AUTOMOUNT
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sat, 1 Jun 2024 21:16:35 +0000 (23:16 +0200)
committerAurelien Jarno <aurel32@debian.org>
Sat, 1 Jun 2024 21:16:35 +0000 (23:16 +0200)
commit bc8879f4f5f3bc19f6f87a0b7136fd5297dce628
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon Nov 6 16:50:51 2023 +0300

    hurd: Stop mapping AT_NO_AUTOMOUNT to O_NOTRANS

    While AT_NO_AUTOMOUNT is similar in function to the Hurd's O_NOTRANS,
    there are significant enough differences in semantics:

    1. AT_NO_AUTOMOUNT has no effect on already established mounts,
       whereas O_NOTRANS causes the lookup to ignore both passive and active
       translators. A better approximation of the AT_NO_AUTOMOUNT behavior
       would be to honor active translators, but avoid starting passive
       ones; like what the file_name_lookup_carefully () routine from
       sutils/clookup.c in the Hurd source tree does.

    2. On GNU/Hurd, translators are used much more pervasively than mounts
       on "traditional" Unix systems: among other things, translators
       underlie features like symlinks, device nodes, and sockets. And while
       on a "traditional" Unix system, the mountpoint and the root of the
       mounted tree may look similar enough for many purposes (they're both
       directories, for one thing), the Hurd allows for any combination of
       the two node types, and indeed it is common to have e.g. a device
       node "mounted" on top of a regular file node on the underlying
       filesystem. Ignoring the translator and stat'ing the underlying node
       is therefore likely to return very different results from what you'd
       get if you stat the translator's root node.

    In practice, mapping AT_NO_AUTOMOUNT to O_NOTRANS was breaking GNU
    Coreutils, including stat(1) and ls(1):

    $ stat /dev/hd0s1
      File: /dev/hd0s1
      Size: 0       Blocks: 8          IO Block: 8192   regular empty file
    Device: 0,8     Inode: 32866       Links: 1

    This was also breaking GNOME's glib, where a g_local_file_stat () call
    that is supposed to stat () a file through a symlink uses
    AT_NO_AUTOMOUNT, which gets mapped to O_NOTRANS, which then causes the
    stat () call to stat symlink itself like lstat () would, rather then the
    file it points to, which is what the logic expects to happen.

    This reverts most of 13710e7e6af6c8965cc9a63a0660cb4ce1966557
    "hurd: Add support for AT_NO_AUTOMOUNT".

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-AT_NO_AUTOMOUNT.diff

hurd/hurd/fd.h

index 824b7dbbae3729fb07febaeab0abb8c70e911738..880f12a4473d36b2dd6c17115a96ee036a862bac 100644 (file)
@@ -300,8 +300,6 @@ __hurd_at_flags (int *at_flags, int *flags)
     *flags &= ~O_NOLINK;
   *at_flags &= ~AT_SYMLINK_FOLLOW;
 
-  if (*at_flags & AT_NO_AUTOMOUNT)
-    *flags |= O_NOTRANS;
   *at_flags &= ~AT_NO_AUTOMOUNT;
 
   if (*at_flags != 0)