bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCHv2 1/2] grantpt: only build pt_chown when needed


From: Eric Blake
Subject: [PATCHv2 1/2] grantpt: only build pt_chown when needed
Date: Wed, 19 Oct 2011 18:01:39 -0600

Any platform (like Linux) that already has a working grantpt()
does not need the headache of a pt_chown helper app.  There's
no point in offering pt_chown as a separate module, since the
application has to be installed setuid to be useful, and even
then, it is only useful to grantpt().

Distributing pt_chown.c is interesting - we cannot rely on
gnulib-tool's EXTRA_lib_SOURCES, as that would try to build
pt_chown.c into libgnu.a.

* modules/pt_chown: Delete, merging into...
* modules/grantpt: ...its sole user.  Make building of pt_chown
depend on an automake conditional.
* gnulib-tool (func_get_automake_snippet_unconditional): Alter
special-casing of pt_chown.c.
* NEWS: Document the change.

Signed-off-by: Eric Blake <address@hidden>
---

v2: also tweak gnulib-tool special-casing

 ChangeLog        |    8 ++++++++
 NEWS             |    5 +++++
 gnulib-tool      |    3 ++-
 modules/grantpt  |   12 +++++++++++-
 modules/pt_chown |   26 --------------------------
 5 files changed, 26 insertions(+), 28 deletions(-)
 delete mode 100644 modules/pt_chown

diff --git a/ChangeLog b/ChangeLog
index 1ea5069..611ff0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-10-19  Eric Blake  <address@hidden>

+       grantpt: only build pt_chown when needed
+       * modules/pt_chown: Delete, merging into...
+       * modules/grantpt: ...its sole user.  Make building of pt_chown
+       depend on an automake conditional.
+       * gnulib-tool (func_get_automake_snippet_unconditional): Alter
+       special-casing of pt_chown.c.
+       * NEWS: Document the change.
+
        openpty: relax license
        * modules/openpty (License): Change from LGPLv3+ to LGPLv2+.

diff --git a/NEWS b/NEWS
index 2e98e61..493a25b 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,11 @@ User visible incompatible changes

 Date        Modules         Changes

+2011-10-19  pt_chown        This module no longer exists.  The helper
+                            application pt_chown is now only built if needed
+                            for the 'grantpt' module, since it has no use
+                            as a stand-alone application.
+
 2011-10-03  poll            The link requirements of this module are changed
                             from empty to $(LIB_POLL).

diff --git a/gnulib-tool b/gnulib-tool
index a1a1251..bf4a8fc 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -2261,6 +2261,8 @@ func_get_automake_snippet_unconditional ()
         } \
         | sed -e "$sed_combine_lines" \
         | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
+      # Exempt files that feed stand-alone executables
+      already_mentioned_files="$already_mentioned_files pt_chown.c"
       all_files=`func_get_filelist $1`
       func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' ''
       # Remove $already_mentioned_files from $lib_files.
@@ -2284,7 +2286,6 @@ func_get_automake_snippet_unconditional ()
       # automake will generate a useless dependency; this is harmless.
       case "$1" in
         relocatable-prog-wrapper) ;;
-        pt_chown) ;;
         *)
           func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
           if test -n "$extra_files"; then
diff --git a/modules/grantpt b/modules/grantpt
index 5fd6537..c8b41ac 100644
--- a/modules/grantpt
+++ b/modules/grantpt
@@ -3,14 +3,16 @@ grantpt() function: Acquire ownership of the slave side of a 
pseudo-terminal.

 Files:
 lib/grantpt.c
+lib/pt_chown.c
+lib/pty-private.h
 m4/grantpt.m4

 Depends-on:
 stdlib
 extensions
-pt_chown        [test $HAVE_GRANTPT = 0]
 waitpid         [test $HAVE_GRANTPT = 0]
 configmake      [test $HAVE_GRANTPT = 0]
+ptsname         [test $HAVE_GRANTPT = 0]

 configure.ac:
 gl_FUNC_GRANTPT
@@ -18,9 +20,17 @@ if test $HAVE_GRANTPT = 0; then
   AC_LIBOBJ([grantpt])
   gl_PREREQ_GRANTPT
 fi
+AM_CONDITIONAL([GL_GENERATE_PT_CHOWN], [test $HAVE_GRANTPT = 0])
 gl_STDLIB_MODULE_INDICATOR([grantpt])

 Makefile.am:
+if GL_GENERATE_PT_CHOWN
+# TODO: Add rules for installing as setuid root (chown root, chmod a=rx,u+s).
+pkglibexec_PROGRAMS = pt_chown
+pt_chown_LDADD = libgnu.a
+else
+EXTRA_DIST += pt_chown.c
+endif

 Include:
 <stdlib.h>
diff --git a/modules/pt_chown b/modules/pt_chown
deleted file mode 100644
index 515df4b..0000000
--- a/modules/pt_chown
+++ /dev/null
@@ -1,26 +0,0 @@
-Description:
-Helper program for setting the owner of the slave side of a pseudo-terminal.
-
-Files:
-lib/pt_chown.c
-lib/pty-private.h
-
-Depends-on:
-ptsname
-stdlib
-configmake
-
-configure.ac:
-
-Makefile.am:
-# TODO: Add rules for installing as setuid root (chown root, chmod a=rx,u+s).
-pkglibexec_PROGRAMS = pt_chown
-pt_chown_LDADD = libgnu.a
-
-Include:
-
-License:
-LGPLv2+
-
-Maintainer:
-glibc
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]