Skip to content

Commit 69e9691

Browse files
authored
[2.7] closes bpo-34652: Always disable lchmod on Linux. (GH-9242)
(cherry picked from commit 40caa05) Co-authored-by: Benjamin Peterson <[email protected]>
1 parent 669429f commit 69e9691

File tree

5 files changed

+39
-79
lines changed

5 files changed

+39
-79
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.

aclocal.m4

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# generated automatically by aclocal 1.15 -*- Autoconf -*-
1+
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
22

3-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
3+
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
44

55
# This file is free software; the Free Software Foundation
66
# gives unlimited permission to copy and/or distribute it,
@@ -12,9 +12,9 @@
1212
# PARTICULAR PURPOSE.
1313

1414
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15-
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16-
# serial 11 (pkg-config-0.29.1)
17-
15+
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
16+
dnl serial 11 (pkg-config-0.29.1)
17+
dnl
1818
dnl Copyright © 2004 Scott James Remnant <[email protected]>.
1919
dnl Copyright © 2012-2015 Dan Nicholson <[email protected]>
2020
dnl
@@ -288,71 +288,3 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
288288
AS_VAR_IF([$1], [""], [$5], [$4])dnl
289289
])dnl PKG_CHECK_VAR
290290

291-
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
292-
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
293-
dnl [DESCRIPTION], [DEFAULT])
294-
dnl ------------------------------------------
295-
dnl
296-
dnl Prepare a "--with-" configure option using the lowercase
297-
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
298-
dnl PKG_CHECK_MODULES in a single macro.
299-
AC_DEFUN([PKG_WITH_MODULES],
300-
[
301-
m4_pushdef([with_arg], m4_tolower([$1]))
302-
303-
m4_pushdef([description],
304-
[m4_default([$5], [build with ]with_arg[ support])])
305-
306-
m4_pushdef([def_arg], [m4_default([$6], [auto])])
307-
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
308-
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
309-
310-
m4_case(def_arg,
311-
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
312-
[m4_pushdef([with_without],[--with-]with_arg)])
313-
314-
AC_ARG_WITH(with_arg,
315-
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
316-
[AS_TR_SH([with_]with_arg)=def_arg])
317-
318-
AS_CASE([$AS_TR_SH([with_]with_arg)],
319-
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
320-
[auto],[PKG_CHECK_MODULES([$1],[$2],
321-
[m4_n([def_action_if_found]) $3],
322-
[m4_n([def_action_if_not_found]) $4])])
323-
324-
m4_popdef([with_arg])
325-
m4_popdef([description])
326-
m4_popdef([def_arg])
327-
328-
])dnl PKG_WITH_MODULES
329-
330-
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
331-
dnl [DESCRIPTION], [DEFAULT])
332-
dnl -----------------------------------------------
333-
dnl
334-
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
335-
dnl check._[VARIABLE-PREFIX] is exported as make variable.
336-
AC_DEFUN([PKG_HAVE_WITH_MODULES],
337-
[
338-
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
339-
340-
AM_CONDITIONAL([HAVE_][$1],
341-
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
342-
])dnl PKG_HAVE_WITH_MODULES
343-
344-
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
345-
dnl [DESCRIPTION], [DEFAULT])
346-
dnl ------------------------------------------------------
347-
dnl
348-
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
349-
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
350-
dnl and preprocessor variable.
351-
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
352-
[
353-
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
354-
355-
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
356-
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
357-
])dnl PKG_HAVE_DEFINE_WITH_MODULES
358-

configure

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ infodir
769769
docdir
770770
oldincludedir
771771
includedir
772+
runstatedir
772773
localstatedir
773774
sharedstatedir
774775
sysconfdir
@@ -880,6 +881,7 @@ datadir='${datarootdir}'
880881
sysconfdir='${prefix}/etc'
881882
sharedstatedir='${prefix}/com'
882883
localstatedir='${prefix}/var'
884+
runstatedir='${localstatedir}/run'
883885
includedir='${prefix}/include'
884886
oldincludedir='/usr/include'
885887
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1132,6 +1134,15 @@ do
11321134
| -silent | --silent | --silen | --sile | --sil)
11331135
silent=yes ;;
11341136

1137+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1138+
| --runstate | --runstat | --runsta | --runst | --runs \
1139+
| --run | --ru | --r)
1140+
ac_prev=runstatedir ;;
1141+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1142+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1143+
| --run=* | --ru=* | --r=*)
1144+
runstatedir=$ac_optarg ;;
1145+
11351146
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11361147
ac_prev=sbindir ;;
11371148
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1269,7 +1280,7 @@ fi
12691280
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12701281
datadir sysconfdir sharedstatedir localstatedir includedir \
12711282
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1272-
libdir localedir mandir
1283+
libdir localedir mandir runstatedir
12731284
do
12741285
eval ac_val=\$$ac_var
12751286
# Remove trailing slashes.
@@ -1422,6 +1433,7 @@ Fine tuning of the installation directories:
14221433
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14231434
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14241435
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1436+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14251437
--libdir=DIR object code libraries [EPREFIX/lib]
14261438
--includedir=DIR C header files [PREFIX/include]
14271439
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -10593,7 +10605,7 @@ for ac_func in alarm setitimer getitimer bind_textdomain_codeset chown \
1059310605
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
1059410606
getentropy \
1059510607
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
10596-
initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \
10608+
initgroups kill killpg lchown lstat mkfifo mknod mktime mmap \
1059710609
mremap nice pathconf pause plock poll pthread_init \
1059810610
putenv readlink realpath \
1059910611
select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
@@ -10616,6 +10628,17 @@ fi
1061610628
done
1061710629
1061810630
10631+
# Force lchmod off for Linux. Linux disallows changing the mode of symbolic
10632+
# links. Some libc implementations have a stub lchmod implementation that always
10633+
# returns an error.
10634+
if test "$MACHDEP" != linux; then
10635+
ac_fn_c_check_func "$LINENO" "lchmod" "ac_cv_func_lchmod"
10636+
if test "x$ac_cv_func_lchmod" = xyes; then :
10637+
10638+
fi
10639+
10640+
fi
10641+
1061910642
# For some functions, having a definition is not sufficient, since
1062010643
# we want to take their address.
1062110644
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for chroot" >&5

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3122,7 +3122,7 @@ AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
31223122
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
31233123
getentropy \
31243124
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
3125-
initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \
3125+
initgroups kill killpg lchown lstat mkfifo mknod mktime mmap \
31263126
mremap nice pathconf pause plock poll pthread_init \
31273127
putenv readlink realpath \
31283128
select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
@@ -3134,6 +3134,13 @@ AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
31343134
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
31353135
truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
31363136

3137+
# Force lchmod off for Linux. Linux disallows changing the mode of symbolic
3138+
# links. Some libc implementations have a stub lchmod implementation that always
3139+
# returns an error.
3140+
if test "$MACHDEP" != linux; then
3141+
AC_CHECK_FUNC(lchmod)
3142+
fi
3143+
31373144
# For some functions, having a definition is not sufficient, since
31383145
# we want to take their address.
31393146
AC_MSG_CHECKING(for chroot)

pyconfig.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@
439439
/* Define to 1 if you have the 'lchflags' function. */
440440
#undef HAVE_LCHFLAGS
441441

442-
/* Define to 1 if you have the `lchmod' function. */
443-
#undef HAVE_LCHMOD
444-
445442
/* Define to 1 if you have the `lchown' function. */
446443
#undef HAVE_LCHOWN
447444

0 commit comments

Comments
 (0)