Skip to content

Commit 883702e

Browse files
benjaminpmiss-islington
authored andcommitted
closes bpo-34652: Always disable lchmod on Linux. (GH-9234)
(cherry picked from commit 40caa05) Co-authored-by: Benjamin Peterson <[email protected]>
1 parent ec4d099 commit 883702e

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure :func:`os.lchmod` is never defined on Linux.

configure

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11354,6 +11354,17 @@ fi
1135411354
done
1135511355

1135611356

11357+
# Force lchmod off for Linux. Linux disallows changing the mode of symbolic
11358+
# links. Some libc implementations have a stub lchmod implementation that always
11359+
# returns an error.
11360+
if test "$MACHDEP" != linux; then
11361+
ac_fn_c_check_func "$LINENO" "lchmod" "ac_cv_func_lchmod"
11362+
if test "x$ac_cv_func_lchmod" = xyes; then :
11363+
11364+
fi
11365+
11366+
fi
11367+
1135711368
ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include <sys/types.h>
1135811369
#include <dirent.h>
1135911370
"

configure.ac

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,6 +3519,13 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
35193519
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
35203520
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty)
35213521

3522+
# Force lchmod off for Linux. Linux disallows changing the mode of symbolic
3523+
# links. Some libc implementations have a stub lchmod implementation that always
3524+
# returns an error.
3525+
if test "$MACHDEP" != linux; then
3526+
AC_CHECK_FUNC(lchmod)
3527+
fi
3528+
35223529
AC_CHECK_DECL(dirfd,
35233530
AC_DEFINE(HAVE_DIRFD, 1,
35243531
Define if you have the 'dirfd' function or macro.), ,

0 commit comments

Comments
 (0)