[glibc] 01/01: hurd-i386/tg-NOFOLLOW-DIRECTORY.diff: New patch to fix O_NOFOLLOW | O_DIRECTORY errors.
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch sid
in repository glibc.
commit 670b030516b7106ae8fda67396d874c164b0a7b7
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Wed Nov 23 01:08:19 2016 +0100
hurd-i386/tg-NOFOLLOW-DIRECTORY.diff: New patch to fix O_NOFOLLOW | O_DIRECTORY errors.
---
debian/changelog | 2 +
.../patches/hurd-i386/tg-NOFOLLOW-DIRECTORY.diff | 44 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 47 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 478f46b..8057df7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ glibc (2.24-7) UNRELEASED; urgency=medium
* hurd-i386/tg-libpthread-gsync-mutex.diff: New patch to make mutexes use
gsync too.
* hurd-i386/tg-NOFOLLOW.diff: New patch to fix O_NOFOLLOW errors.
+ * hurd-i386/tg-NOFOLLOW-DIRECTORY.diff: New patch to fix O_NOFOLLOW |
+ O_DIRECTORY errors.
-- Aurelien Jarno <aurel32@debian.org> Mon, 21 Nov 2016 19:24:59 +0100
diff --git a/debian/patches/hurd-i386/tg-NOFOLLOW-DIRECTORY.diff b/debian/patches/hurd-i386/tg-NOFOLLOW-DIRECTORY.diff
new file mode 100644
index 0000000..cf93670
--- /dev/null
+++ b/debian/patches/hurd-i386/tg-NOFOLLOW-DIRECTORY.diff
@@ -0,0 +1,44 @@
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Subject: [PATCH] hurd: Fix O_DIRECTORY | O_NOFOLLOW
+
+Appending / to the path to be looked up makes us always follow a final
+symlink, even with O_NOTRANS (since the final resolution is after the
+'/'). In the O_DIRECTORY | O_NOFOLLOW case, we thus have to really open
+the node and stat it, which we already do anyway, and check for
+directory type.
+
+Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+---
+ hurd/hurdlookup.c | 2 +-
+ hurd/lookup-retry.c | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
+index dbff009..bd720c2 100644
+--- a/hurd/hurdlookup.c
++++ b/hurd/hurdlookup.c
+@@ -72,7 +72,7 @@ __hurd_file_name_lookup (error_t (*use_init_port)
+ if (flags & O_NOFOLLOW) /* See lookup-retry.c about O_NOFOLLOW. */
+ flags |= O_NOTRANS;
+
+- if (flags & O_DIRECTORY)
++ if (flags & O_DIRECTORY && !(flags & O_NOFOLLOW))
+ {
+ /* The caller wants to require that the file we look up is a directory.
+ We can do this without an extra RPC by appending a trailing slash
+diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
+index b7a6a2b..d372959 100644
+--- a/hurd/lookup-retry.c
++++ b/hurd/lookup-retry.c
+@@ -147,6 +147,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
+ err = __io_stat (*result, &st);
+ if (!err)
+ {
++ if (flags & O_DIRECTORY && !S_ISDIR(st.st_mode))
++ err = ENOTDIR;
+ if (S_ISLNK(st.st_mode))
+ err = ELOOP;
+ else if (st.st_mode & (S_IPTRANS|S_IATRANS))
+--
+tg: (2bc1a49..) t/NOFOLLOW-DIRECTORY (depends on: t/NOFOLLOW)
diff --git a/debian/patches/series b/debian/patches/series
index 575ca65..e56c952 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -137,6 +137,7 @@ hurd-i386/tg-libpthread-gsync-spin.diff
hurd-i386/tg-ONSTACK.diff
hurd-i386/tg-libpthread-gsync-mutex.diff
hurd-i386/tg-NOFOLLOW.diff
+hurd-i386/tg-NOFOLLOW-DIRECTORY.diff
i386/local-biarch.diff
i386/local-cmov.diff
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git
Reply to: