From 628c7baa85934252389017886f36cd3d025a6ddb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 17 Jul 2006 03:13:14 +0000 Subject: [PATCH] chmod, install, and mkdir now leave setgid and setuid bits of directories alone unless you specify them explicitly. install and mkdir now implement X correctly. install now creates parent directories with mode 755, without changing their owner or group. --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ doc/ChangeLog | 22 ++++++++++++++++++++++ lib/ChangeLog | 27 +++++++++++++++++++++++++++ m4/ChangeLog | 10 ++++++++++ 4 files changed, 97 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5c96c9e..00875b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2006-07-16 Paul Eggert + + * NEWS: chmod, install, and mkdir now leave setgid and setuid bits + of directories alone unless you specify them explicitly. + install and mkdir now implement X correctly. + install now creates parent directories with mode 755, without + changing their owner or group. + * src/chmod.c (process_file): Adjust to mode_adjust API change. + * src/install.c: Include mkancesdirs.h. + (announce_mkdir, make_ancestor): New functions. + (DEFAULT_MODE): New macro, specifying initial value of 'mode'. + (mode): Use it. + (dir_mode, dir_mode_bits): New vars. + (main): Set dir modes separately from nondir, so that the X + op of -m works correctly. + (main): Remove cwd_errno cruft, since make_dir_parents no longer + affects cwd. Adjust to new make_dir_parents API. + (install_file_in_file_parents): 2nd arg is now char *, not char + const *. Use mkancesdirs instead of rolling our own code. + (change_attributes): Don't worry about AFS, since that kludge + should not be needed any more. + * mkdir.c (struct mkdir_options): New struct. + (announce_mkdir, make_ancestor): New functions. + (main): Use them. Adjust to mode_adjust API change. Stick with + umask 0. Use make_dir_parents for all the work. + * mkfifo.c (main): Adjust to new mode_adjust API. + * mknod.c (main): Likewise. + * tests/chmod/setgid: Do the setgid test instead of bailing. + * tests/mkdir/p-3: Remove re_protect case that no longer applies. + GNU chmod now behaves like other versions of chmod. + * tests/mkdir/perm: Add a test for the X bug. + +2006-07-14 Paul Eggert + + * src/base64.c (do_decode): Output to parameter OUT, not to stdout. + This doesn't fix any bugs, since OUT always equals stdout, but it + makes the code easier to understand. + 2006-07-14 Jim Meyering * Makefile.maint (CVS_LIST): Use new file, build-aux/vc-list-files, diff --git a/doc/ChangeLog b/doc/ChangeLog index 518a3f1..ab3cdd5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,25 @@ +2006-07-16 Paul Eggert + + * coreutils.texi: Change GNU to @acronym{GNU} in a few places. + Use "set-user-ID" and "set-group-ID" a bit more consistently. + Use "appropriate privileges" rather than "super-user" a bit + more consistently. + (install invocation): Parent directories are now 755 without uid + or gid changing. The default mode is now 0755, not 755. + (mkdir invocation): Rewrite the top-level usage description, since + I couldn't easily follow the old one. It's now 3 lines not 8. + For -m, describe file permission bits versus other bits, and note + that mkdir is atomic if you don't mention special bits. + (chmod invocation): Mention what chmod does to setgid and setuid bits. + * perm.texi (Mode Structure): Modernize the explanation of the + setuid and setgid bits on directories. + (Changing Special Mode Bits): Mention that a implies both u and g + for s. Cross reference to new node. + (Numeric Modes): Don't claim that 0055 is the same as 55; this isn't + true any more. Mention new node. + 4755 is now like u=rwxs,go=rx,g-s, not like u=rwxs,go=rx. + (Directory Setuid and Setgid): New node. + 2006-07-08 Jim Meyering * coreutils.texi (Squeezing): Separate doubled "the", so typo-checkers diff --git a/lib/ChangeLog b/lib/ChangeLog index 774159f..7437f1f 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,30 @@ +2006-07-16 Paul Eggert + + * dirchownmod.c, dirchownmod.h, mkancesdirs.c, mkancesdirs.h: + New files. + * mkdir-p.c: Don't include alloca.h, stdio.h, sys/types.h, + unistd.h, string.h, chdir-safer.h, dirname.h, lchmod.h, lchown.h, + save-cwd.h. Instead, include dirchownmod.h and mkancesdirs.h. + (make_dir_parents): New args MAKE_ANCESTOR, OPTIONS, ANNOUNCE, + MODE_BITS. Remove options VERBOSE_FMT_STRING, CWD_ERRNO. All + callers changed. Revamp internals significantly, by not + attempting to create directories that are temporarily more + permissive than the final results. Do not attempt to use + save_cwd/restore_cwd; it isn't worth it for mkdir and install. + This removes some race conditions, fixes some bugs, and simplifies + things. Use new dirchownmod function to do owner and mode changes. + * mkdir-p.h: Likewise. + * modechange.c (octal_to_mode): New function. + (struct mode_change): New member mentioned. + (make_node_op_equals): New arg mentioned. All callers changed. + (mode_compile): Keep track of which mode bits the user has explicitly + mentioned. + (mode_adjust): New arg DIR, so that we implement the X op correctly. + New arg PMODE_BITS, to keep track of which mode bits the user + mentioned; it treats S_ISUID and S_ISGID speciall. + All callers changed. + * lib/modechange.h: Likewise. + 2006-07-16 Jim Meyering * userspec.c (parse_with_separator): Say "invalid spec" rather than diff --git a/m4/ChangeLog b/m4/ChangeLog index abeddd2..0e0b6b0 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,13 @@ +2006-07-16 Paul Eggert + + * mkancesdirs.m4: New file. + * afs.m4: Remove; no longer needed. + * jm-macros.m4 (gl_MACROS): Remove gl_AFS. + * mkdir-p.m4 (gl_MKDIR_PARENTS): Mention dirchownmod.c, dirchownmod.h. + Don't require AC_FUNC_ALLOCA, gl_AFS, gl_CHDIR_SAFER; no longer needed. + Require gl_FUNC_LCHOWN, since dirchownmod.c needs it. + * prereq.m4 (gl_PREREQ): Require gl_MKANCESDIRS. + 2006-07-11 Eric Blake * absolute-header.m4: Fix comments to match recent change. -- 2.7.4