Discussion:
[PATCH] chdir-safer: remove this module
(too old to reply)
Paul Eggert
2017-12-31 00:35:35 UTC
Permalink
* MODULES.html.sh (func_all_modules): Remove chdir-safer.
* NEWS: Document removal.
* lib/chdir-safer.c, lib/chdir-safer.h, m4/afs.m4, m4/chdir-safer.m4:
* modules/chdir-safer: Remove these files.
---
ChangeLog | 8 ++++++
MODULES.html.sh | 1 -
NEWS | 3 ++
lib/chdir-safer.c | 82 -----------------------------------------------------
lib/chdir-safer.h | 20 -------------
m4/afs.m4 | 17 -----------
m4/chdir-safer.m4 | 10 -------
modules/chdir-safer | 31 --------------------
8 files changed, 11 insertions(+), 161 deletions(-)
delete mode 100644 lib/chdir-safer.c
delete mode 100644 lib/chdir-safer.h
delete mode 100644 m4/afs.m4
delete mode 100644 m4/chdir-safer.m4
delete mode 100644 modules/chdir-safer

diff --git a/ChangeLog b/ChangeLog
index 213a453..48c02ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-12-30 Paul Eggert <***@cs.ucla.edu>
+
+ chdir-safer: remove this module
+ * MODULES.html.sh (func_all_modules): Remove chdir-safer.
+ * NEWS: Document removal.
+ * lib/chdir-safer.c, lib/chdir-safer.h, m4/afs.m4, m4/chdir-safer.m4:
+ * modules/chdir-safer: Remove these files.
+
2017-12-29 Samuel Thibault <***@gnu.org>

Add cross-compilation results for GNU/Hurd.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 2cf7594..6115506 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2652,7 +2652,6 @@ func_all_modules ()
func_module backup-rename
func_module canonicalize
func_module canonicalize-lgpl
- func_module chdir-safer
func_module clean-temp
func_module concat-filename
func_module copy-file
diff --git a/NEWS b/NEWS
index 9ec3a15..f4fc2e2 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,9 @@ User visible incompatible changes

Date Modules Changes

+2017-12-30 chdir-safer This module is removed. It was deprecated
+ on 2006-07-17.
+
2017-11-24 posixtm Previously, callers had to specify either
PDS_LEADING_YEAR or PDS_TRAILING_YEAR (but
not both). Now, callers should specify
diff --git a/lib/chdir-safer.c b/lib/chdir-safer.c
deleted file mode 100644
index c0644cf..0000000
--- a/lib/chdir-safer.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* much like chdir(2), but safer
-
- Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-/* written by Jim Meyering */
-
-#include <config.h>
-
-#include "chdir-safer.h"
-
-#include <stdbool.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "same-inode.h"
-
-#ifndef HAVE_READLINK
-# define HAVE_READLINK 0
-#endif
-
-/* Like chdir, but fail if DIR is a symbolic link to a directory (or
- similar funny business). This avoids a minor race condition
- between when a directory is created or statted and when the process
- chdirs into it.
-
- On older systems lacking full support for O_SEARCH, this function
- can also fail if DIR is not readable. */
-int
-chdir_no_follow (char const *dir)
-{
- int result = 0;
- int saved_errno;
- int fd = open (dir,
- O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK);
- if (fd < 0)
- return -1;
-
- /* If open follows symlinks, lstat DIR and fstat FD to ensure that
- they are the same file; if they are different files, set errno to
- ELOOP (the same value that open uses for symlinks with
- O_NOFOLLOW) so the caller can report a failure.
- Skip this check if HAVE_READLINK == 0, which should be the case
- on any system that lacks symlink support. */
- if (HAVE_READLINK && ! HAVE_WORKING_O_NOFOLLOW)
- {
- struct stat sb1;
- result = lstat (dir, &sb1);
- if (result == 0)
- {
- struct stat sb2;
- result = fstat (fd, &sb2);
- if (result == 0 && ! SAME_INODE (sb1, sb2))
- {
- errno = ELOOP;
- result = -1;
- }
- }
- }
-
- if (result == 0)
- result = fchdir (fd);
-
- saved_errno = errno;
- close (fd);
- errno = saved_errno;
- return result;
-}
diff --git a/lib/chdir-safer.h b/lib/chdir-safer.h
deleted file mode 100644
index 1505f96..0000000
--- a/lib/chdir-safer.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* much like chdir(2), but safer
-
- Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-/* Written by Jim Meyering. */
-
-int chdir_no_follow (char const *file);
diff --git a/m4/afs.m4 b/m4/afs.m4
deleted file mode 100644
index 5f8fafd..0000000
--- a/m4/afs.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-# serial 10
-
-# Copyright (C) 1999-2001, 2004, 2008-2017 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_AFS],
- [
- AC_ARG_WITH([afs],
- AS_HELP_STRING([--with-afs],
- [support for the Andrew File System [[default=no]]]),
- test "$withval" = no || with_afs=yes, with_afs=no)
- if test "$with_afs" = yes; then
- AC_DEFINE([AFS], [1], [Define if you have the Andrew File System.])
- fi
- ])
diff --git a/m4/chdir-safer.m4 b/m4/chdir-safer.m4
deleted file mode 100644
index f4c890a..0000000
--- a/m4/chdir-safer.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-#serial 5
-dnl Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_CHDIR_SAFER],
-[
- AC_CHECK_FUNCS_ONCE([readlink])
-])
diff --git a/modules/chdir-safer b/modules/chdir-safer
deleted file mode 100644
index 7455b32..0000000
--- a/modules/chdir-safer
+++ /dev/null
@@ -1,31 +0,0 @@
-Description:
-like chdir, but safer
-
-Files:
-lib/chdir-safer.h
-lib/chdir-safer.c
-m4/chdir-safer.m4
-
-Depends-on:
-errno
-fchdir
-fcntl-h
-fstat
-open
-same-inode
-stdbool
-
-configure.ac:
-gl_CHDIR_SAFER
-
-Makefile.am:
-lib_SOURCES += chdir-safer.c
-
-Include:
-"chdir-safer.h"
-
-License:
-GPL
-
-Maintainer:
-Jim Meyering
--
2.7.4
Loading...