Compare commits

...

160 Commits

Author SHA1 Message Date
Jim Meyering
ceb3908c6f . 2001-01-14 20:28:14 +00:00
Jim Meyering
4468f22968 *** empty log message *** 2001-01-14 20:28:03 +00:00
Jim Meyering
eb3dc6a095 Remove conftestdir{,2} before trying to create the directory.
Make the entire configure script fail if the mkdir fails.
2001-01-14 20:27:56 +00:00
Jim Meyering
4a65486da9 (UINT_MAX_32_BITS): Define.
Use UINT_MAX_32_BITS in the cpp conditions that determine
the `word32' typedef.  Using a literal `0xffffffff' failed with
HPUX10.20's /bin/cc.
2001-01-14 20:26:28 +00:00
Jim Meyering
07872e486f *** empty log message *** 2001-01-14 16:42:50 +00:00
Jim Meyering
5aba961278 use id's -ng options, not -nG 2001-01-14 16:27:08 +00:00
Jim Meyering
9be1481d17 *** empty log message *** 2001-01-14 15:37:48 +00:00
Jim Meyering
eda1fa3268 *** empty log message *** 2001-01-14 15:37:22 +00:00
Jim Meyering
633a2ace39 *** empty log message *** 2001-01-14 15:36:53 +00:00
Jim Meyering
c2329c797c . 2001-01-14 15:35:19 +00:00
Jim Meyering
4d8de6887f *** empty log message *** 2001-01-14 15:35:07 +00:00
Jim Meyering
5b2304d7b4 Include stdlib.h, string.h or strings.h, and xalloc.h.
Use strip_trailing_slashes rather than open-coding it.
2001-01-14 15:34:22 +00:00
Jim Meyering
b6863fa3c9 *** empty log message *** 2001-01-14 15:28:54 +00:00
Jim Meyering
c0ba4297c5 Use temporary directories named conftestdir{,2}, not
foo and bar.  Create conftestdir/ in the script, not in the C code.
Remove directories in the script, not in the C code.
2001-01-14 15:28:45 +00:00
Jim Meyering
acc13fdc89 from Volker Borchert 2001-01-14 11:08:35 +00:00
Jim Meyering
ee56fd2719 (jm_MACROS): Require vb_FUNC_RENAME. 2001-01-14 11:07:45 +00:00
Jim Meyering
16863fa14e check for SunOS4.1.1U bug in rename 2001-01-14 11:07:28 +00:00
Jim Meyering
c957bbdeae (TESTS): Add trailing-slash. 2001-01-14 11:06:20 +00:00
Jim Meyering
c6a4fe00db from Volker Borchert 2001-01-14 11:05:50 +00:00
Jim Meyering
30fc8c55a3 [RENAME_TRAILING_SLASH_BUG]: Use the rename wrapper. 2001-01-14 11:04:47 +00:00
Jim Meyering
98c8115e96 *** empty log message *** 2001-01-14 09:42:01 +00:00
Jim Meyering
d6b863b09c (update-po): Merge po-files in temporary files
in the build directory, and update the source directory only when
the merged catalog differs from the original.  This fixes the known
`make distcheck' failure due to `make update-po' being called
on up-to-date but read-only files.
2001-01-14 09:41:53 +00:00
Jim Meyering
c730e2d9e8 *** empty log message *** 2001-01-13 15:59:19 +00:00
Jim Meyering
81268e4b67 . 2001-01-13 15:57:48 +00:00
Jim Meyering
896a20a2a9 *** empty log message *** 2001-01-13 15:56:33 +00:00
Jim Meyering
455ce0178b (TESTS): Add into-self-4. 2001-01-13 15:56:29 +00:00
Jim Meyering
e268536dba *** empty log message *** 2001-01-13 15:55:35 +00:00
Jim Meyering
e2aae9e166 add comment to go along with last change 2001-01-13 15:50:01 +00:00
Jim Meyering
8e4dbf5ab0 *** empty log message *** 2001-01-13 15:49:01 +00:00
Jim Meyering
b7138e1052 (same_file_ok): When moving a symlink onto itself,
don't remove the symlink.  Reported by David Luyer as Debian bug#82089,
via Michael Stone.
2001-01-13 15:48:32 +00:00
Jim Meyering
5775f7e864 *** empty log message *** 2001-01-12 23:27:53 +00:00
Jim Meyering
6deb757ba4 * tests/chmod/setgid: If `chmod g+s d' fails, then try to chgrp
to a group of which we're a member, then try the chmod again.
2001-01-12 23:27:43 +00:00
Jim Meyering
a0d25e62aa *** empty log message *** 2001-01-11 16:58:40 +00:00
Jim Meyering
dc38e3a287 *** empty log message *** 2001-01-11 16:04:46 +00:00
Jim Meyering
7b99d77bc6 *** empty log message *** 2001-01-10 23:30:56 +00:00
Jim Meyering
1a79f34996 . 2001-01-10 23:08:51 +00:00
Jim Meyering
ad3ec0add1 *** empty log message *** 2001-01-10 13:44:13 +00:00
Jim Meyering
a3ffafd3fe . 2001-01-10 12:20:03 +00:00
Jim Meyering
2d33b67399 (TESTS): Add into-self. 2001-01-10 12:19:05 +00:00
Jim Meyering
e7e6c322a0 (copy_internal): Add a comment.
Set *copy_into_self in the new code that detects that.
Make diagnostic more consistent: s/won't/will not/.
[move_mode, copy_into_self]: Give a diagnstic here, now that
we have the top_level_* globals.  Remove the corresponding diagnostic
from mv.c.
Add a FIXME comment.
2001-01-10 12:18:19 +00:00
Jim Meyering
9ea9eed873 (do_move): Remove diagnostic, now that copy.c issues it.
Set `fail' to nonzero in the primary `if (copy_into_self)' block
rather than in its own tiny one below.
2001-01-10 12:16:52 +00:00
Jim Meyering
d882d1d100 *** empty log message *** 2001-01-10 11:56:59 +00:00
Jim Meyering
b6e29912be [struct entry] (node): Describe how it's used,
now that we've overloaded it a little, in order to detect and diagnose
the copying-directory-into-self problem.
(new_file): Remove global.
(htab): Declare global to be static.
(remember_created): Insert file name instead of dummy pointer, so
that copy.c can use the just-created directory name to detect
the copying-directory-into-self problem.
2001-01-10 11:54:53 +00:00
Jim Meyering
687ef9f9fe *** empty log message *** 2001-01-10 10:29:57 +00:00
Jim Meyering
4e1f4a8496 *** empty log message *** 2001-01-10 10:27:09 +00:00
Jim Meyering
c1485dd854 *** empty log message *** 2001-01-10 09:58:43 +00:00
Jim Meyering
35099b35ba *** empty log message *** 2001-01-10 09:56:04 +00:00
Jim Meyering
2a5fb11132 (copy_internal): Don't allow cp (or mv, when working
across a partition boundary) to overwrite a non-directory with a directory.
2001-01-10 09:43:36 +00:00
Jim Meyering
a49513bedd *** empty log message *** 2001-01-10 09:42:16 +00:00
Jim Meyering
fc6a8dcfb2 *** empty log message *** 2001-01-10 09:41:46 +00:00
Jim Meyering
cbb4300cc2 (TESTS): Add dir-vs-file. 2001-01-10 09:41:41 +00:00
Jim Meyering
deb79403bd *** empty log message *** 2001-01-10 09:41:15 +00:00
Jim Meyering
9f43a52210 *** empty log message *** 2001-01-10 09:40:47 +00:00
Jim Meyering
6bf0f043cd *** empty log message *** 2001-01-10 09:40:05 +00:00
Jim Meyering
3f1cd6f52a *** empty log message *** 2001-01-10 09:39:57 +00:00
Jim Meyering
d1da062806 *** empty log message *** 2001-01-09 23:13:08 +00:00
Jim Meyering
bce88bc1ae *** empty log message *** 2001-01-09 16:13:29 +00:00
Jim Meyering
8740ecf8c0 add comment 2001-01-09 16:12:59 +00:00
Jim Meyering
e92e87181b (top_level_src_path, top_level_dst_path): New globals.
(copy_internal): Use them.
(copy): Set them.
2001-01-09 16:07:40 +00:00
Jim Meyering
902dacb46a *** empty log message *** 2001-01-09 15:50:13 +00:00
Jim Meyering
134bbf752c whoops. move printf args, too 2001-01-08 08:34:52 +00:00
Jim Meyering
b27dd775ad (usage): Split long message string. 2001-01-07 16:15:37 +00:00
Jim Meyering
e230d9a62b *** empty log message *** 2001-01-07 16:13:34 +00:00
Jim Meyering
7709a02741 Split a string that was longer than 2048 bytes. 2001-01-07 16:13:27 +00:00
Jim Meyering
aaf9e9a820 (usage): Split a string that was longer than 2048 bytes. 2001-01-07 16:11:14 +00:00
Jim Meyering
674fed73ec (usage): Split a string that was longer than 2048 bytes. 2001-01-07 16:10:50 +00:00
Jim Meyering
98d1d862d5 back out last, prematurely-committed, change 2001-01-07 16:07:33 +00:00
Jim Meyering
aaef348f3d Correct the indentation of an `#endif'. 2001-01-07 16:06:27 +00:00
Jim Meyering
9bc96fd932 clean up after commit hook testing 2001-01-07 10:57:29 +00:00
Jim Meyering
7b0658b00f testing -- commit should fail 2001-01-07 10:54:06 +00:00
Jim Meyering
f4034df457 testing -- commit should fail 2001-01-07 10:52:43 +00:00
Jim Meyering
5856751f41 testing -- commit should fail 2001-01-07 10:51:00 +00:00
Jim Meyering
4df9c47ca7 (usage): Untabify. 2001-01-07 10:12:25 +00:00
Jim Meyering
354a71cdc2 *** empty log message *** 2001-01-07 10:12:16 +00:00
Jim Meyering
481c79dfac *** empty log message *** 2001-01-07 09:23:28 +00:00
Jim Meyering
5e32f7c19a s/can not/cannot/ 2001-01-07 09:23:18 +00:00
Jim Meyering
c5b4a727ab *** empty log message *** 2001-01-07 09:21:41 +00:00
Jim Meyering
8c07ff563b (parse_group): Normalize spelling. 2001-01-07 09:21:34 +00:00
Jim Meyering
fa997616ff normalize spelling in comment 2001-01-07 09:20:47 +00:00
Jim Meyering
0edd80c0f2 *** empty log message *** 2001-01-04 17:59:32 +00:00
Jim Meyering
cc49da4ddf (main): Fail when --rfc-822 (-R) is specified along
with a format string.  Reported by Jochen Hein.
2001-01-04 17:59:22 +00:00
Jim Meyering
b7b4bec8df . 2001-01-04 14:00:07 +00:00
Jim Meyering
7aed2f97a5 . 2001-01-04 10:19:49 +00:00
Jim Meyering
89c7458b53 Sync with glibc time/strftime.c 1.81. 2001-01-04 10:19:43 +00:00
Jim Meyering
0809f17d77 . 2001-01-03 21:04:52 +00:00
Jim Meyering
550edf90b2 Use the more precise algorithm of GNU "make" to decide whether
a file is in the future, by looking at high-resolution time
stamps if available.

(TIMESPEC_NS): New macro.
(current_time): Initialize to the minimum value.
(current_time_ns): New var.
(main): Do not bother to initialize current_time;
it's no longer needed.
(get_current_time): New function.
(print_long_format): Use it when a file appears to be in the future.
Get the nanoseconds of the file's time stamp, if available,
and use that to decide whether the file appears	to be in the future.
2001-01-03 21:02:08 +00:00
Jim Meyering
f3aa989205 check for existing behavior 2001-01-03 16:16:56 +00:00
Jim Meyering
f8a894c567 *** empty log message *** 2001-01-03 11:37:46 +00:00
Jim Meyering
a0439c2405 (main): Remove embedded \n from diagnostic. 2001-01-03 11:36:10 +00:00
Jim Meyering
edfabc70d3 *** empty log message *** 2001-01-03 10:16:14 +00:00
Jim Meyering
9e14c22918 (AM_GNU_GETTEXT): Define MKINSTALLDIRS by
expanding the value of $ac_aux_dir, as in AM_MISSING_HAS_RUN,
so `make install' also works in VPATH builds.
2001-01-03 10:16:02 +00:00
Jim Meyering
f3334434ea *** empty log message *** 2001-01-03 10:09:08 +00:00
Jim Meyering
5686f159ab (print_unicode_char): Remove `const' from declaration of
local `inptr' to avoid warning with some system declarations of iconv.
2001-01-03 10:08:43 +00:00
Jim Meyering
b7f12e5291 *** empty log message *** 2001-01-03 10:06:53 +00:00
Jim Meyering
954daed8c2 . 2001-01-03 09:47:20 +00:00
Jim Meyering
b042ca3c0f (long_time_expected_width, print_long_format): Fix
bug: the initial byte passed to strftime wasn't initialized to
a nonzero value after the buffer was reallocated.
2001-01-03 09:47:09 +00:00
Jim Meyering
5d3b5e175a *** empty log message *** 2001-01-03 09:45:43 +00:00
Jim Meyering
1f13191b6f (install-data-yes): If the package is
fileutils, install LC_TIME as an alias for LC_MESSAGES.
2001-01-03 09:45:32 +00:00
Jim Meyering
5aa665a624 (dcgettext): New macro. 2001-01-03 09:44:56 +00:00
Jim Meyering
85a5e683e8 (decode_switches): Use dcgettext with LC_TIME,
not plain gettext, to get the translations of time formats.
2001-01-03 09:44:15 +00:00
Jim Meyering
e646037f4a . 2001-01-03 09:38:55 +00:00
Jim Meyering
536a6dd3ce (long_time_expected_width): New function.
(print_long_format): Use it, so that we don't assume a
particular width for time stamps in an internationalized
environment.
2001-01-03 09:15:22 +00:00
Jim Meyering
701cc3fe2c *** empty log message *** 2001-01-02 15:50:18 +00:00
Jim Meyering
22fc5f7ac9 (ulonglong_t): Define place-holder type to avoid some #if directives.
(LONGEST_INTEGRAL_TYPE): Remove definition.
(MAX_INTEGRAL_TYPE_SIZE): Use ulonglong_t instead of LONGEST_INTEGRAL_TYPE.
(print_long_long): Compile this function even on systems without
long long support.
(decode_one_format): Remove #if directive.
2001-01-02 15:48:21 +00:00
Jim Meyering
4dcf0e2c7b . 2001-01-02 15:31:41 +00:00
Jim Meyering
67aea68e97 *** empty log message *** 2001-01-02 10:55:34 +00:00
Jim Meyering
2320b98d89 (decode_one_format): Guard use of print_long_long with
`#if HAVE_UNSIGNED_LONG_LONG'.  From Darren Salt.
Change all `#ifdef HAVE_UNSIGNED_LONG_LONG' to use `#if' instead.
2001-01-02 10:54:55 +00:00
Jim Meyering
4f90505509 *** empty log message *** 2001-01-02 10:44:38 +00:00
Jim Meyering
4fcf9133ef *** empty log message *** 2001-01-02 07:21:36 +00:00
Jim Meyering
1f29ee0e02 *** empty log message *** 2001-01-02 07:20:13 +00:00
Jim Meyering
5285933ed8 copyright 2001-01-02 07:19:59 +00:00
Jim Meyering
1efbe325bd (print_long_format):
Report the year for files even slightly in the future.
Avoid overflow problems near Y2038 on 32-bit hosts.
To calculate "six months", take half the average Gregorian
year, not 180 days.
2001-01-02 07:18:56 +00:00
Jim Meyering
1f678f44f9 *** empty log message *** 2001-01-02 07:14:47 +00:00
Jim Meyering
895cf6e91f . 2001-01-01 18:17:10 +00:00
Jim Meyering
682bc57d89 (jm_PREREQ_READUTMP): Include utmp.h (if available), even
on systems with utmpx.h.  It's necessary for the declaration of utmp's
ut_user member.  Reported by Andreas Jaeger.
2001-01-01 18:16:52 +00:00
Jim Meyering
74ac72a78f . 2001-01-01 18:09:31 +00:00
Jim Meyering
f324aa68f9 (jm_CHECK_DECLS): Include grp.h and pwd.h if available.
They are required for the declarations of getgrgid and getpwuid resp.
(_jm_DECL_HEADERS): Check for grp.h and pwd.h.
2001-01-01 18:08:48 +00:00
Jim Meyering
88db6b6944 . 2001-01-01 10:59:50 +00:00
Jim Meyering
387d125c2d *** empty log message *** 2001-01-01 10:52:32 +00:00
Jim Meyering
fd77d94155 *** empty log message *** 2001-01-01 10:51:32 +00:00
Jim Meyering
137c6d5137 (TESTS): Add setgid. 2001-01-01 10:51:22 +00:00
Jim Meyering
671567d496 *** empty log message *** 2001-01-01 10:49:52 +00:00
Jim Meyering
aa3ef39ac8 *** empty log message *** 2000-12-31 13:24:28 +00:00
Jim Meyering
b360fa26e5 (AM_WITH_NLS): When using AC_CONFIG_AUX_DIR,
prepend $(top_srcdir) to the value of MKINSTALLDIRS so that it
can be used in subdirectories.
2000-12-31 12:15:42 +00:00
Jim Meyering
168401bef2 *** empty log message *** 2000-12-31 12:12:41 +00:00
Jim Meyering
9ecf7a54be . 2000-12-31 09:51:50 +00:00
Jim Meyering
b46b6af7e3 . 2000-12-31 09:49:33 +00:00
Jim Meyering
318e97ef64 File renamed from tests/sticky-check.
All uses of "sticky" changed to "setgid".
2000-12-31 09:49:23 +00:00
Jim Meyering
9b525d2fe1 sticky-check -> setgid-check 2000-12-31 09:48:35 +00:00
Jim Meyering
7a5e723600 sticky-check -> setgid-check 2000-12-31 09:48:10 +00:00
Jim Meyering
9a2e78d703 sticky-check -> setgid-check 2000-12-31 09:46:15 +00:00
Jim Meyering
b28d611552 *** empty log message *** 2000-12-31 09:21:28 +00:00
Jim Meyering
f39ef82a14 . 2000-12-31 09:19:25 +00:00
Jim Meyering
c76348c318 (TESTS): Add deref-slink. 2000-12-31 09:17:00 +00:00
Jim Meyering
dd9804a4fe New file. Test for the bug fixed by my 2000-12-28 change to copy.c. 2000-12-31 09:15:44 +00:00
Jim Meyering
f0018a3b9c Improve performance by invoking gettext twice at the start,
instead of once for each file.
(long_time_format): New var.
(decode_switches): Initialize it, if format == long_format.
(print_long_format): Use it.
2000-12-31 09:06:54 +00:00
Jim Meyering
9adb2c7cf1 *** empty log message *** 2000-12-31 08:55:58 +00:00
Jim Meyering
857c948551 (print_long_format): Don't dump core if strftime returns the empty string. 2000-12-31 08:55:41 +00:00
Jim Meyering
33cf956fc8 *** empty log message *** 2000-12-31 08:33:59 +00:00
Jim Meyering
66816a3514 (gobble_file): If not using long format, don't invoke acl; it's not needed. 2000-12-31 08:33:49 +00:00
Jim Meyering
6417617d33 *** empty log message *** 2000-12-31 08:30:28 +00:00
Jim Meyering
769b95b751 Avoid an unnecessary `stat' when using --dereference.
(same_file_ok): Use stat only if lstat reported that
the file was a symbolic link.
2000-12-31 08:29:17 +00:00
Jim Meyering
de0ebc7eb6 *** empty log message *** 2000-12-30 16:51:42 +00:00
Jim Meyering
d8271b06b4 append-only directories -> restricted deletion flag,
which is the term that POSIX d5 uses for this notion.
2000-12-30 16:51:24 +00:00
Jim Meyering
206205c6ee *** empty log message *** 2000-12-29 10:32:33 +00:00
Jim Meyering
3336d7cf69 Do not assume that mode_t uses the
traditional octal encoding.  E.g. "chmod 1 FOO" should set
the other-execute bit of FOO even if S_IXOTH != 1.

(SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
WOTH, XOTH, ALLM): New macros.
(S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
 S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
Use them.
(S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
(S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
(mode_compile):
No need to use uintmax_t; unsigned long is long enough.
Don't bother to get suffix since we don't use it.
2000-12-29 10:32:09 +00:00
Jim Meyering
c319b5bf3b *** empty log message *** 2000-12-29 08:58:38 +00:00
Jim Meyering
de577f3440 Try /usr/xpg4/bin/id (Solaris 7) if plain 'id' doesn't work. 2000-12-29 08:58:25 +00:00
Jim Meyering
9f0489df43 . 2000-12-28 14:43:13 +00:00
Jim Meyering
46e7805428 Run sticky-check from just-created directory. 2000-12-28 14:40:15 +00:00
Jim Meyering
d4b4519d8d *** empty log message *** 2000-12-28 13:35:28 +00:00
Jim Meyering
b8d4bfe024 . 2000-12-28 13:17:02 +00:00
Jim Meyering
7046dfbc47 tweak comment 2000-12-28 11:52:28 +00:00
Jim Meyering
f119221740 tweak comment 2000-12-28 11:31:44 +00:00
Jim Meyering
fe38ed9d90 *** empty log message *** 2000-12-28 11:23:55 +00:00
Jim Meyering
bc9ff8c14d (same_file_ok): Fix *another* typo from my 2000-09-03 change: s/tmp_dst_sb/tmp_src_sb/. 2000-12-28 11:22:59 +00:00
Jim Meyering
a400a0e081 *** empty log message *** 2000-12-28 09:53:58 +00:00
Jim Meyering
3abbefb5e4 (same_file_ok): Fix typo from my 2000-09-03 change: s/tmp_dst_sb/tmp_src_sb/. 2000-12-28 09:53:34 +00:00
Jim Meyering
51d5f8a438 (same_file_ok): Use a single auto var for
tmp_dst_sb, instead of two static vars.
Likewise for tmp_src_sb.
2000-12-28 09:42:06 +00:00
Jim Meyering
e8c1aced2b *** empty log message *** 2000-12-28 09:41:39 +00:00
71 changed files with 1189 additions and 193 deletions

3
THANKS
View File

@@ -66,8 +66,10 @@ Collin Rogowski collin@rogowski.de
Dan Hagerty hag@gnu.ai.it.edu
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
Darren Salt ds@youmustbejoking.demon.co.uk
David Dyck dcd@tc.fluke.COM
David Godfrey dave@delta.demon.co.uk
David Luyer david_luyer@pacific.net.au
Dennis Henriksen opus@flamingo.osrl.dk
Derek Clegg dclegg@next.com
Dick Streefland dick_streefland@tasking.com
@@ -210,6 +212,7 @@ Michael ??? michael@roka.net
Michael Deutschmann michael@talamasca.ocis.net
Michael Hasselberg mikelh@zonta.ping.de
Michael Hohn hohn@math.utah.edu
Michael J. Croghan mcroghan@usatoday.com
Michael Stone mstone@debian.org
Michael Stutz stutz@dsl.org
Michael Veksler mveksler@techunix.technion.ac.il

View File

@@ -69,11 +69,12 @@ matter what group the user who creates them is in.
@cindex sticky
@cindex swap space, saving text image in
@cindex text image, saving in swap space
@cindex append-only directories
@cindex restricted deletion flag
save the program's text image on the swap device so it will load more
quickly when run (called the @dfn{sticky bit}). For directories on some
systems, prevent users from removing files that they do not own in the
directory; this is called making the directory @dfn{append-only}.
systems, prevent users from removing or renaming a file in a directory
unless they own the file or the directory; this is called the
@dfn{restriction deletion flag} for the directory.
@end enumerate
@node Symbolic Modes
@@ -118,7 +119,7 @@ format:
@noindent
The spaces between the three parts above are shown for readability only;
symbolic modes can not contain spaces.
symbolic modes cannot contain spaces.
The @var{users} part tells which users' access to the file is changed.
It consists of one or more of the following letters (or it can be empty;
@@ -427,7 +428,7 @@ This number is always interpreted in octal; you do not have to add a
leading 0, as you do in C. Mode 0055 is the same as mode 55.
A numeric mode is usually shorter than the corresponding symbolic
mode, but it is limited in that it can not take into account a file's
mode, but it is limited in that it cannot take into account a file's
previous permissions; it can only set them absolutely.
On most systems, the permissions granted to the user,

View File

@@ -1,3 +1,35 @@
2001-01-14 Jim Meyering <meyering@lucent.com>
* rename.c: New file. From Volker Borchert.
Include stdlib.h, string.h or strings.h, and xalloc.h.
Use strip_trailing_slashes rather than open-coding it.
2001-01-03 Paul Eggert <eggert@twinsun.com>
* lib/strftime.c: Sync with glibc time/strftime.c 1.81.
2001-01-03 Jim Meyering <meyering@lucent.com>
* unicodeio.c (print_unicode_char): Remove `const' from declaration of
local `inptr' to avoid warning with some system declarations of iconv.
2000-12-29 Paul Eggert <eggert@twinsun.com>
* lib/modechange.c: Do not assume that mode_t uses the
traditional octal encoding. E.g. "chmod 1 FOO" should set
the other-execute bit of FOO even if S_IXOTH != 1.
(SUID, SGID, SVTX, RUSR, WUSR, XUSR, RGRP, WGRP, XGRP, ROTH,
WOTH, XOTH, ALLM): New macros.
(S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH):
Use them.
(S_ISGID): Fix typo; it was defaulting to the same value as S_ISUID.
(S_IRWXU, S_IRWXG, S_IRWXO): Specify defaults in terms of the above.
(mode_compile):
No need to use uintmax_t; unsigned long is long enough.
Don't bother to get suffix since we don't use it.
2000-12-24 Jim Meyering <meyering@lucent.com>
* hash.c (is_prime): Return explicit boolean values.

View File

@@ -222,12 +222,12 @@ $(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po \
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/physmem$U.Po \
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quote$U.Po \
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po \
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rmdir.Po \
$(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po $(DEPDIR)/same$U.Po \
$(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po $(DEPDIR)/sha$U.Po \
$(DEPDIR)/stat.Po $(DEPDIR)/stime.Po $(DEPDIR)/stpcpy.Po \
$(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po $(DEPDIR)/strdup.Po \
$(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rename.Po \
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
$(DEPDIR)/sha$U.Po $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
$(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po \
$(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \
$(DEPDIR)/strpbrk.Po $(DEPDIR)/strstr.Po $(DEPDIR)/strtod.Po \
$(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po \
@@ -243,10 +243,10 @@ error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
getusershell.c group-member.c lchown.c malloc.c memchr.c memcmp.c \
memcpy.c memmove.c memrchr.c memset.c mktime.c mountlist.c nanosleep.c \
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c \
rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c strftime.c \
strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c strtod.c strtol.c \
strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
obstack.c obstack.h putenv.c readutmp.c realloc.c regex.c rename.c \
rmdir.c rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c \
strftime.c strncasecmp.c strndup.c strnlen.c strpbrk.c strstr.c \
strtod.c strtol.c strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -446,6 +446,8 @@ realloc_.c: realloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > realloc_.c
regex_.c: regex.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > regex_.c
rename_.c: rename.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rename_.c
rmdir_.c: rmdir.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rmdir_.c
rpmatch_.c: rpmatch.c $(ANSI2KNR)
@@ -536,11 +538,11 @@ makepath_.o malloc_.o mbswidth_.o md5_.o memcasecmp_.o memchr_.o \
memcmp_.o memcoll_.o memcpy_.o memmove_.o memrchr_.o memset_.o \
mktime_.o modechange_.o mountlist_.o nanosleep_.o obstack_.o \
path-concat_.o physmem_.o posixtm_.o putenv_.o quote_.o quotearg_.o \
readtokens_.o readutmp_.o realloc_.o regex_.o rmdir_.o rpmatch_.o \
safe-read_.o same_.o save-cwd_.o savedir_.o sha_.o stat_.o stime_.o \
stpcpy_.o strcasecmp_.o strcspn_.o strdup_.o strftime_.o stripslash_.o \
strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o \
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
readtokens_.o readutmp_.o realloc_.o regex_.o rename_.o rmdir_.o \
rpmatch_.o safe-read_.o same_.o save-cwd_.o savedir_.o sha_.o stat_.o \
stime_.o stpcpy_.o strcasecmp_.o strcspn_.o strdup_.o strftime_.o \
stripslash_.o strncasecmp_.o strndup_.o strnlen_.o strpbrk_.o strstr_.o \
strtod_.o strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o \
unicodeio_.o userspec_.o utime_.o version-etc_.o xgetcwd_.o \
xgethostname_.o xmalloc_.o xstrdup_.o xstrtod_.o xstrtol_.o xstrtoul_.o \
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
@@ -660,6 +662,7 @@ maintainer-clean-tags:
@AMDEP@include $(DEPDIR)/readutmp.Po
@AMDEP@include $(DEPDIR)/realloc.Po
@AMDEP@include $(DEPDIR)/regex.Po
@AMDEP@include $(DEPDIR)/rename.Po
@AMDEP@include $(DEPDIR)/rmdir.Po
@AMDEP@include $(DEPDIR)/rpmatch.Po
@AMDEP@include $(DEPDIR)/safe-read$U.Po

View File

@@ -1,5 +1,5 @@
/* modechange.c -- file mode manipulation
Copyright (C) 1989, 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001 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
@@ -50,50 +50,65 @@ char *malloc ();
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* The traditional octal values corresponding to each mode bit. */
#define SUID 04000
#define SGID 02000
#define SVTX 01000
#define RUSR 00400
#define WUSR 00200
#define XUSR 00100
#define RGRP 00040
#define WGRP 00020
#define XGRP 00010
#define ROTH 00004
#define WOTH 00002
#define XOTH 00001
#define ALLM 07777 /* all octal mode bits */
#ifndef S_ISUID
# define S_ISUID 04000
# define S_ISUID SUID
#endif
#ifndef S_ISGID
# define S_ISGID 04000
# define S_ISGID SGID
#endif
#ifndef S_ISVTX
# define S_ISVTX 01000
# define S_ISVTX SVTX
#endif
#ifndef S_IRUSR
# define S_IRUSR 0400
# define S_IRUSR RUSR
#endif
#ifndef S_IWUSR
# define S_IWUSR 0200
# define S_IWUSR WUSR
#endif
#ifndef S_IXUSR
# define S_IXUSR 0100
# define S_IXUSR XUSR
#endif
#ifndef S_IRGRP
# define S_IRGRP 0040
# define S_IRGRP RGRP
#endif
#ifndef S_IWGRP
# define S_IWGRP 0020
# define S_IWGRP WGRP
#endif
#ifndef S_IXGRP
# define S_IXGRP 0010
# define S_IXGRP XGRP
#endif
#ifndef S_IROTH
# define S_IROTH 0004
# define S_IROTH ROTH
#endif
#ifndef S_IWOTH
# define S_IWOTH 0002
# define S_IWOTH WOTH
#endif
#ifndef S_IXOTH
# define S_IXOTH 0001
# define S_IXOTH XOTH
#endif
#ifndef S_IRWXU
# define S_IRWXU 0700
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#ifndef S_IRWXG
# define S_IRWXG 0070
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#endif
#ifndef S_IRWXO
# define S_IRWXO 0007
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#endif
/* All the mode bits that can be affected by chmod. */
@@ -157,8 +172,7 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
{
struct mode_change *head; /* First element of the linked list. */
struct mode_change *tail; /* An element of the linked list. */
uintmax_t mode_value; /* The mode value, if octal. */
char *string_end; /* Pointer to end of parsed value. */
unsigned long octal_value; /* The mode value, if octal. */
mode_t umask_value; /* The umask value (surprise). */
head = NULL;
@@ -166,12 +180,34 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
tail = NULL;
#endif
if (xstrtoumax (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
if (xstrtoul (mode_string, NULL, 8, &octal_value, "") == LONGINT_OK)
{
struct mode_change *p;
if (mode_value != (mode_value & CHMOD_MODE_BITS))
mode_t mode;
if (octal_value != (octal_value & ALLM))
return MODE_INVALID;
p = make_node_op_equals ((mode_t) mode_value);
/* Help the compiler optimize the usual case where mode_t uses
the traditional octal representation. */
mode = ((S_ISUID == SUID && S_ISGID == SGID && S_ISVTX == SVTX
&& S_IRUSR == RUSR && S_IWUSR == WUSR && S_IXUSR == XUSR
&& S_IRGRP == RGRP && S_IWGRP == WGRP && S_IXGRP == XGRP
&& S_IROTH == ROTH && S_IWOTH == WOTH && S_IXOTH == XOTH)
? octal_value
: ((octal_value & SUID ? S_ISUID : 0)
| (octal_value & SGID ? S_ISGID : 0)
| (octal_value & SVTX ? S_ISVTX : 0)
| (octal_value & RUSR ? S_IRUSR : 0)
| (octal_value & WUSR ? S_IWUSR : 0)
| (octal_value & XUSR ? S_IXUSR : 0)
| (octal_value & RGRP ? S_IRGRP : 0)
| (octal_value & WGRP ? S_IWGRP : 0)
| (octal_value & XGRP ? S_IXGRP : 0)
| (octal_value & ROTH ? S_IROTH : 0)
| (octal_value & WOTH ? S_IWOTH : 0)
| (octal_value & XOTH ? S_IXOTH : 0)));
p = make_node_op_equals (mode);
if (p == NULL)
return MODE_MEMORY_EXHAUSTED;
mode_append_entry (&head, &tail, p);
@@ -393,7 +429,7 @@ mode_adjust (mode_t oldmode, const struct mode_change *changes)
/* In order to change only `u', `g', or `o' permissions,
or some combination thereof, clear unselected bits.
This can not be done in mode_compile because the value
This cannot be done in mode_compile because the value
to which the `changes->affected' mask is applied depends
on the old mode of each file. */
value &= changes->affected;

68
lib/rename.c Normal file
View File

@@ -0,0 +1,68 @@
/* Work around the bug in some systems whereby rename fails when the source
path has a trailing slash. The rename from SunOS 4.1.1_U1 has this bug.
Copyright (C) 2001 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 2, 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, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Volker Borchert */
#include <config.h>
#include <stdio.h>
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#include <xalloc.h>
#ifndef HAVE_DECL_FREE
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_FREE
void free ();
#endif
void strip_trailing_slashes ();
/* Rename the file SRC_PATH to DST_PATH, removing any trailing
slashes from SRC_PATH. Needed for SunOS 4.1.1_U1. */
int
rpl_rename (const char *src_path, const char *dst_path)
{
char *src_temp;
int ret_val;
size_t s_len = strlen (src_path);
if (s_len && src_path[s_len - 1] == '/')
{
src_temp = xstrdup (src_path);
strip_trailing_slashes (src_temp);
}
else
src_temp = (char *) src_path;
ret_val = rename (src_temp, dst_path);
if (src_temp != src_path)
free (src_temp);
return ret_val;
}

View File

@@ -289,7 +289,7 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
else if (to_uppcase) \
memcpy_uppcase (p, (s), _n); \
else \
MEMCPY ((PTR) p, (PTR) (s), _n))
MEMCPY ((PTR) p, (const PTR) (s), _n))
#ifdef COMPILE_WIDE
# define widen(os, ws, l) \
@@ -793,10 +793,11 @@ my_strftime (s, maxsize, format, tp ut_argument)
goto bad_format;
#ifdef _NL_CURRENT
if (! (modifier == 'E'
&& (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
NLW(ERA_D_T_FMT)))
&& (*(subfmt =
(const CHAR_T *) _NL_CURRENT (LC_TIME,
NLW(ERA_D_T_FMT)))
!= '\0')))
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_T_FMT));
#else
# if HAVE_STRFTIME
goto underlying_strftime;
@@ -887,10 +888,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
goto bad_format;
#ifdef _NL_CURRENT
if (! (modifier == L_('E')
&& (*(subfmt = (CHAR_T *)_NL_CURRENT (LC_TIME,
NLW(ERA_D_FMT)))
&& (*(subfmt =
(const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
!= L_('\0'))))
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
goto subformat;
#else
# if HAVE_STRFTIME
@@ -1073,8 +1074,9 @@ my_strftime (s, maxsize, format, tp ut_argument)
case L_('r'): /* POSIX.2 extension. */
#ifdef _NL_CURRENT
if (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
NLW(T_FMT_AMPM))) == L_('\0'))
if (*(subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME,
NLW(T_FMT_AMPM)))
== L_('\0'))
#endif
subfmt = L_("%I:%M:%S %p");
goto subformat;
@@ -1129,10 +1131,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
goto bad_format;
#ifdef _NL_CURRENT
if (! (modifier == L_('E')
&& (*(subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME,
NLW(ERA_T_FMT)))
&& (*(subfmt =
(const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_T_FMT)))
!= L_('\0'))))
subfmt = (CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(T_FMT));
goto subformat;
#else
# if HAVE_STRFTIME

View File

@@ -158,7 +158,7 @@ print_unicode_char (FILE *stream, unsigned int code)
{
#if HAVE_ICONV
char outbuf[25];
const char *inptr;
char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;

View File

@@ -1,3 +1,39 @@
2001-01-14 Jim Meyering <meyering@lucent.com>
* rename.m4: Use temporary directories named conftestdir{,2}, not
foo and bar. Create conftestdir/ in the script, not in the C code.
Remove directories in the script, not in the C code.
Remove conftestdir{,2} before trying to create the directory.
Make the entire configure script fail if the mkdir fails.
2001-01-02 Volker Borchert <bt@teknon.de>
* rename.m4: New file.
* jm-macros.m4 (jm_MACROS): Require vb_FUNC_RENAME.
2001-01-01 Alexandre Duret-Lutz <duret_g@epita.fr>
* libintl.m4 (AM_GNU_GETTEXT): Define MKINSTALLDIRS by
expanding the value of $ac_aux_dir, as in AM_MISSING_HAS_RUN,
so `make install' also works in VPATH builds.
2001-01-01 Jim Meyering <meyering@lucent.com>
* prereq.m4 (jm_PREREQ_READUTMP): Include utmp.h (if available), even
on systems with utmpx.h. It's necessary for the declaration of utmp's
ut_user member. Reported by Andreas Jaeger.
* check-decl.m4 (jm_CHECK_DECLS): Include grp.h and pwd.h if available.
They are required for the declarations of getgrgid and getpwuid resp.
(_jm_DECL_HEADERS): Check for grp.h and pwd.h.
Reported by Andreas Jaeger.
2000-12-25 Alexandre Duret-Lutz <duret_g@epita.fr>
* libintl.m4 (AM_WITH_NLS): When using AC_CONFIG_AUX_DIR,
prepend $(top_srcdir) to the value of MKINSTALLDIRS so that it
can be used in subdirectories.
2000-12-26 Jim Meyering <meyering@lucent.com>
* dos.m4 (jm_AC_DOS): Rewrite (though it's still a stub) to work better

View File

@@ -52,6 +52,7 @@ putenv.m4 \
readdir.m4 \
realloc.m4 \
regex.m4 \
rename.m4 \
rmdir-errno.m4 \
search-libs.m4 \
st_dm_mode.m4 \

View File

@@ -167,6 +167,7 @@ putenv.m4 \
readdir.m4 \
realloc.m4 \
regex.m4 \
rename.m4 \
rmdir-errno.m4 \
search-libs.m4 \
st_dm_mode.m4 \

View File

@@ -3,7 +3,7 @@ and textutils packages.
These files are used by a program called aclocal (part of the GNU automake
package). aclocal uses these files to create aclocal.m4 which is in turn
used by autoconf to create the configure script at the the top level in
used by autoconf to create the configure script at the top level in
this distribution.
The Makefile.am file in this directory is automatically generated

View File

@@ -1,4 +1,4 @@
#serial 16
#serial 17
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between
@@ -41,6 +41,14 @@ AC_DEFUN(jm_CHECK_DECLS,
#if HAVE_UTMP_H
# include <utmp.h>
#endif
#if HAVE_GRP_H
# include <grp.h>
#endif
#if HAVE_PWD_H
# include <pwd.h>
#endif
'
AC_CHECK_DECLS([
@@ -72,6 +80,6 @@ dnl This is a little helper so we can require these header checks.
AC_DEFUN(_jm_DECL_HEADERS,
[
AC_REQUIRE([AC_HEADER_STDC])
AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h sys/time.h \
utmp.h utmpx.h)
AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
unistd.h sys/time.h utmp.h utmpx.h)
])

View File

@@ -1,4 +1,4 @@
#serial 29 -*- autoconf -*-
#serial 30 -*- autoconf -*-
dnl Misc type-related macros for fileutils, sh-utils, textutils.
@@ -103,6 +103,7 @@ AC_DEFUN(jm_MACROS,
AC_FUNC_GETLOADAVG([lib])
AC_REQUIRE([jm_SYS_PROC_UPTIME])
AC_REQUIRE([jm_FUNC_FTRUNCATE])
AC_REQUIRE([vb_FUNC_RENAME])
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
AC_REPLACE_FUNCS(dup2)

View File

@@ -6,7 +6,7 @@
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 109
# serial 110
AC_PREREQ(2.13) dnl Minimum Autoconf version required.
@@ -289,7 +289,7 @@ strdup __argz_count __argz_stringify __argz_next])
dnl Try to locate it.
MKINSTALLDIRS=
if test -n "$ac_aux_dir"; then
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
MKINSTALLDIRS="`CDPATH=:; cd $ac_aux_dir && pwd`/mkinstalldirs"
fi
if test -z "$MKINSTALLDIRS"; then
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"

View File

@@ -1,4 +1,4 @@
#serial 13
#serial 14
dnl These are the prerequisite macros for files in the lib/
dnl directories of the fileutils, sh-utils, and textutils packages.
@@ -91,7 +91,8 @@ AC_DEFUN(jm_PREREQ_READUTMP,
$ac_includes_default
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
#else
#endif
#ifdef HAVE_UTMP_H
# include <utmp.h>
#endif
"

40
m4/rename.m4 Normal file
View File

@@ -0,0 +1,40 @@
#serial 1
dnl From Volker Borchert.
dnl Determine whether rename works for source paths with a trailing slash.
dnl The rename from SunOS 4.1.1_U1 doesn't.
dnl
dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
dnl to compile the wrapper function.
dnl
AC_DEFUN(vb_FUNC_RENAME,
[
AC_CACHE_CHECK([whether rename is broken],
vb_cv_func_rename_trailing_slash_bug,
[
rm -rf conftestdir conftestdir2
mkdir conftestdir ||
AC_MSG_ERROR([cannot create temporary directory])
AC_TRY_RUN([
# include <stdio.h>
int
main ()
{
exit (rename ("conftestdir/", "conftestdir2") ? 1 : 0);
}
],
vb_cv_func_rename_trailing_slash_bug=no,
vb_cv_func_rename_trailing_slash_bug=yes,
dnl When crosscompiling, assume rename is broken.
vb_cv_func_rename_trailing_slash_bug=yes)
rm -rf conftestdir conftestdir2
])
if test $vb_cv_func_rename_trailing_slash_bug = yes; then
AC_LIBOBJ(rename)
AC_DEFINE_UNQUOTED(RENAME_TRAILING_SLASH_BUG, 1,
[Define if rename does not work for source paths with a trailing slash,
like the one from SunOS 4.1.1_U1.])
fi
])

View File

@@ -1,10 +1,241 @@
2001-01-14 Jim Meyering <meyering@lucent.com>
* Version 4.0.36.
* src/shred.c (UINT_MAX_32_BITS): Define.
Use UINT_MAX_32_BITS in the cpp conditions that determine
the `word32' typedef. Using a literal `0xffffffff' failed with
HPUX10.20's /bin/cc.
* config.sub: Update from master repository.
* config.guess: Likewise.
2001-01-02 Volker Borchert <bt@teknon.de>
Work around a broken rename system call, e.g. on SunOS 4.1.1_U1,
that fails when the source path has a trailing slash.
* src/copy.h [RENAME_TRAILING_SLASH_BUG]: Use the rename wrapper.
* tests/mv/trailing-slash: Test whether the workaround works.
* tests/m4/Makefile.am (TESTS): Add trailing-slash.
2001-01-03 Alexandre Duret-Lutz <duret_g@epita.fr>
* po/Makefile.in.in (update-po): Merge po-files in temporary files
in the build directory, and update the source directory only when
the merged catalog differs from the original. This fixes the known
`make distcheck' failure due to `make update-po' being called
on up-to-date but read-only files.
2001-01-13 Jim Meyering <meyering@lucent.com>
* src/copy.c (same_file_ok): When moving a symlink onto itself,
don't remove the symlink. Reported by David Luyer as Debian bug#82089,
via Michael Stone.
* tests/mv/into-self-4: New test for the above.
* tests/mv/Makefile.am (TESTS): Add into-self-4.
* tests/chmod/setgid: If `chmod g+s d' fails, then try to chgrp
to a group of which we're a member, then try the chmod again.
2001-01-11 Jim Meyering <meyering@lucent.com>
* depcomp: New version, from automake.
2001-01-10 Jim Meyering <meyering@lucent.com>
* src/copy.c (copy_internal): Add a comment.
Set *copy_into_self in the new code that detects that.
Make diagnostic more consistent: s/won't/will not/.
[move_mode, copy_into_self]: Give a diagnstic here, now that
we have the top_level_* globals. Remove the corresponding diagnostic
from mv.c.
Add a FIXME comment.
* src/mv.c (do_move): Remove diagnostic, now that copy.c issues it.
Set `fail' to nonzero in the primary `if (copy_into_self)' block
rather than in its own tiny one below.
* src/copy.c (copy_internal): Don't allow cp (or mv, when working
across a partition boundary) to overwrite a non-directory with a
directory. Reported by Michael J. Croghan.
* tests/cp/dir-vs-file: New test for the above.
* tests/cp/Makefile.am (TESTS): Add dir-vs-file.
2001-01-09 Jim Meyering <meyering@lucent.com>
Give a better diagnostic for `cp -R a a'.
* src/copy.c (top_level_src_path, top_level_dst_path): New globals.
(copy_internal): Use them.
(copy): Set them.
* src/cp-hash.c [struct entry] (node): Describe how it's used,
now that we've overloaded it, in order to detect and diagnose
the copying-directory-into-self problem.
(new_file): Remove global.
(htab): Declare global to be static.
(remember_created): Insert file name instead of dummy pointer, so
that copy.c can use the just-created directory name to detect
the copying-directory-into-self problem.
* tests/cp/into-self: New test for the above.
* tests/cp/Makefile.am (TESTS): Add into-self.
2001-01-07 Jim Meyering <meyering@lucent.com>
* src/cp.c (usage): Split a string that was longer than 2048 bytes.
* doc/perm.texi: s/can not/cannot/
2001-01-07 Karl Eichwalder <ke@suse.de>
* src/chown.c (usage): Split long message string.
2001-01-07 Karl Eichwalder <ke@suse.de>
* src/ls.c (usage): Untabify.
* src/chgrp.c (parse_group): Normalize spelling.
2001-01-03 Paul Eggert <eggert@twinsun.com>
* NEWS: Document the planned --full-time change.
* doc/fileutils.texi: Likewise.
* NEWS: Document that time stamps depend on LC_TIME, not LC_MESSAGES.
2001-01-03 Paul Eggert <eggert@twinsun.com>
Use the more precise algorithm of GNU "make" to decide whether
a file is in the future, by looking at high-resolution time
stamps if available.
* src/ls.c:
(TIMESPEC_NS): New macro.
(current_time): Initialize to the minimum value.
(current_time_ns): New var.
(main): Do not bother to initialize current_time;
it's no longer needed.
(get_current_time): New function.
(print_long_format): Use it when a file appears to be in the future.
Get the nanoseconds of the file's time stamp, if available,
and use that to decide whether the file appears to be in the future.
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD): New macros.
2001-01-02 Paul Eggert <eggert@twinsun.com>
* src/ls.c (long_time_expected_width, print_long_format): Fix
bug: the initial byte passed to strftime wasn't initialized to
a nonzero value after the buffer was reallocated.
2001-01-02 Paul Eggert <eggert@twinsun.com>
Make ls -l compatible with POSIX, which requires that the
behavior of time formats must depend only on LC_TIME, not on
LC_MESSAGES.
* po/Makefile.in.in (install-data-yes): If the package is
fileutils, install LC_TIME as an alias for LC_MESSAGES.
* src/sys2.h (dcgettext): New macro.
* src/ls.c (decode_switches): Use dcgettext with LC_TIME,
not plain gettext, to get the translations of time formats.
2001-01-02 Paul Eggert <eggert@twinsun.com>
* src/ls.c (long_time_expected_width): New function.
(print_long_format): Use it, so that we don't assume a
particular width for time stamps in an internationalized
environment.
2001-01-01 Paul Eggert <eggert@twinsun.com>
* doc/fileutils.texi, NEWS:
ls -l now reports the year for files even slightly in the future, as
POSIX requires. This helps warn users about clock skew problems.
* src/ls.c (print_long_format):
Report the year for files even slightly in the future.
Avoid overflow problems near Y2038 on 32-bit hosts.
To calculate "six months", take half the average Gregorian
year, not 180 days.
2001-01-01 Jim Meyering <meyering@lucent.com>
* tests/chmod/Makefile.am (TESTS): Add setgid.
* tests/chmod/setgid: Test for chmod's existing behavior.
Based on a report from Paul Eggert.
2000-12-29 Paul Eggert <eggert@twinsun.com>
Clean up the terminology a tad: some directories were called "sticky"
when they were really setgid.
* tests/Makefile.am (EXTRA_DIST): sticky-check -> setgid-check
* tests/chmod/c-option, tests/cp/cp-parents, tests/mkdir/parents,
tests/mkdir/perm: Likewise.
* tests/setgid-check: File renamed from tests/sticky-check.
All uses of "sticky" changed to "setgid".
2000-12-31 Jim Meyering <meyering@lucent.com>
* tests/cp/Makefile.am (TESTS): Add deref-slink.
* tests/cp/deref-slink: New file. Test for the bug fixed by my
2000-12-28 change to copy.c.
2000-12-30 Paul Eggert <eggert@twinsun.com>
* src/ls.c: Improve performance by invoking gettext twice at the start,
instead of once for each file.
(long_time_format): New var.
(decode_switches): Initialize it, if format == long_format.
(print_long_format): Use it.
2000-12-30 Paul Eggert <eggert@twinsun.com>
* src/ls.c (print_long_format): Don't dump core if strftime
returns the empty string.
2000-12-30 Paul Eggert <eggert@twinsun.com>
* src/ls.c (gobble_file): If not using long format, don't
invoke acl; it's not needed.
2000-12-30 Jim Meyering <meyering@lucent.com>
Avoid an unnecessary `stat' when using --dereference.
* src/copy.c (same_file_ok): Use stat only if lstat reported that
the file was a symbolic link.
2000-12-29 Paul Eggert <eggert@twinsun.com>
* doc/perm.texi: append-only directories -> restricted deletion flag,
which is the term that POSIX d5 uses for this notion.
2000-12-28 Paul Eggert <eggert@twinsun.com>
* tests/group-names: Try /usr/xpg4/bin/id (Solaris 7) if plain
'id' doesn't work.
2000-12-28 Jim Meyering <meyering@lucent.com>
* tests/cp/cp-parents: Run sticky-check from just-created directory.
2000-12-28 Jim Meyering <meyering@lucent.com>
* src/copy.c (same_file_ok): Fix two typos from my 2000-09-03 change:
s/tmp_dst_sb/tmp_src_sb/.
2000-12-27 Paul Eggert <eggert@twinsun.com>
* tests/sticky-check: Turn off the working directory's sticky
bit, so that we don't have to worry about it later.
* src/copy.c (same_file_ok): Use a single auto var for
tmp_dst_sb, instead of two static vars. Likewise for
tmp_src_sb.
2000-12-26 Jim Meyering <meyering@lucent.com>
* Version 4.0.35.
* Regenerate build/config framework to use automake-1.4b and
the latest CVS version autoconf.
* tests/mkdir/perm: Disable the test if the working directory has
the sticky bit set.
* tests/cp/cp-parents: Likewise.
@@ -13,6 +244,7 @@
2000-12-25 Jim Meyering <meyering@lucent.com>
Clean-up to avoid warnings from Irix's c89.
* src/remove.c (hash_compare_active_dir_ents): Return explicit `true'
or `false', rather than relying on implicit int-to-enum cast.
* src/copy.c (same_file_ok): Remove declaration and set of unused

View File

@@ -1,4 +1,18 @@
Changes in release 4.01:
[4.0.36]
* `mv dir/ new-name' no longer fails on SunOS4.1.1U
* attempting to use mv to move a symlink onto itself no longer removes
the symlink
* `cp -R directory file' no longer removes `file'. now it fails and gives
a diagnostic
* The manual now warns that ls's --full-time format string is planned
to change in a future release.
* ls -l's time stamp format now depends on LC_TIME, not LC_MESSAGES,
as POSIX requires.
* ls -l now reports the year for files even slightly in the future, as
POSIX requires. This helps warn users about clock skew problems.
* `cp -d file symlink-to-some-other-file' no longer fails
* performance improvements for ls
[4.0.35]
* ln --backup=simple --suffix=SUFFIX once again uses SUFFIX
* install: Likewise.
@@ -15,7 +29,9 @@ Changes in release 4.01:
[4.0.33]
* dd now accepts skip=nB and seek=nB, to advance past some number of bytes, n,
that need not be a multiple of the block size.
* dd (without conv=notrunc) now uses ftruncate only on regular files
* dd (without conv=notrunc) now complains only when ftruncate fails on a
regular file, a directory, or a shared memory object -- not when it fails
to truncate other types of files, like /dev/fd0.
* chmod --changes (-c) once again issues diagnostics only for the files
with changed permissions
* mkdir now gives one diagnostic (rather than two) for certain failures

View File

@@ -1,3 +1,8 @@
2001-01-04 Jim Meyering <meyering@lucent.com>
* src/date.c (main): Fail when --rfc-822 (-R) is specified along
with a format string. Reported by Jochen Hein.
2000-12-17 Jim Meyering <meyering@lucent.com>
* doc/texinfo.tex: Update from master repository.

View File

@@ -1,3 +1,26 @@
2001-01-07 Jim Meyering <meyering@lucent.com>
* src/tail.c (usage): Split a string that was longer than 2048 bytes.
2001-01-03 Jim Meyering <meyering@lucent.com>
* src/sort.c (main): Remove embedded \n from diagnostic.
2001-01-02 Jim Meyering <meyering@lucent.com>
* src/od.c (ulonglong_t): Define place-holder type to avoid some #if
directives.
(LONGEST_INTEGRAL_TYPE): Remove definition.
(MAX_INTEGRAL_TYPE_SIZE): Use ulonglong_t instead of
LONGEST_INTEGRAL_TYPE.
(print_long_long): Compile this function even on systems without
long long support.
(decode_one_format): Remove #if directive.
* src/od.c (decode_one_format): Guard use of print_long_long with
`#if HAVE_UNSIGNED_LONG_LONG'. From Darren Salt.
Change all `#ifdef HAVE_UNSIGNED_LONG_LONG' to use `#if' instead.
2000-12-23 Jim Meyering <meyering@lucent.com>
* src/sys2.h [HAVE_INTTYPES_H]: Include <inttypes.h>.

View File

@@ -150,6 +150,13 @@ install-data-yes: all
true; \
fi; \
fi; \
if test "$(PACKAGE)" = "fileutils"; then \
timedir=$$destdir/$$lang/LC_TIME; \
rm -fr $$timedir; \
ln -s LC_MESSAGES $$timedir \
|| (mkdir $$timedir && ln $$dir/* $$timedir); \
echo "installing $$timedir as an alias for $$dir"; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -x "$(MKINSTALLDIRS)"; then \
@@ -206,20 +213,25 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile
$(MAKE) $(PACKAGE).pot
PATH=`pwd`/../src:$$PATH; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
if $(MSGMERGE) $(srcdir)/$$lang.po \
$(srcdir)/$(PACKAGE).pot -o $$lang.new.po; then \
if cmp $$lang.new.po $(srcdir)/$$lang.po >/dev/null; then \
echo "$$lang.po is unchanged"; \
rm -f $$lang.new.po; \
else \
echo "updating $$lang.po"; \
rm -f $(srcdir)/$$lang.po; \
mv $$lang.new.po $(srcdir)/$$lang.po; \
fi; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
rm -f $$lang.new.po; \
exit 1; \
fi; \
done

View File

@@ -1,5 +1,5 @@
/* chgrp -- change group ownership of files
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 1995-2001 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
@@ -91,7 +91,7 @@ parse_group (const char *name, gid_t *g)
struct group *grp;
if (*name == '\0')
error (1, 0, _("can not change to null group"));
error (1, 0, _("cannot change to null group"));
grp = getgrnam (name);
if (grp == NULL)

View File

@@ -1,5 +1,5 @@
/* chown -- change user and group ownership of files
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 1995-2001 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
@@ -126,6 +126,8 @@ Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
"));
printf (_("\
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
to login group if implied by a `:'. OWNER and GROUP may be numeric as well\n\
as symbolic.\n\

View File

@@ -1,5 +1,5 @@
/* copy.c -- core functions for copying files and directories
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
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
@@ -67,6 +67,11 @@ static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
int *copy_into_self,
int *rename_succeeded));
/* Pointers to the file names: they're used in the diagnostic that is issued
when we detect the user is trying to copy a directory into itself. */
static char const *top_level_src_path;
static char const *top_level_dst_path;
/* The invocation name of this program. */
extern char *program_name;
@@ -392,6 +397,8 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
{
const struct stat *src_sb_link;
const struct stat *dst_sb_link;
struct stat tmp_dst_sb;
struct stat tmp_src_sb;
int same_link;
int same = (SAME_INODE (*src_sb, *dst_sb));
@@ -415,17 +422,15 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
/* If both the source and destination files are symlinks (and we'll
know this here IFF preserving symlinks (aka xstat == lstat),
then it's ok. */
then it's ok -- as long as they are distinct. */
if (S_ISLNK (src_sb->st_mode) && S_ISLNK (dst_sb->st_mode))
return 1;
return ! same_name (src_path, dst_path);
src_sb_link = src_sb;
dst_sb_link = dst_sb;
}
else
{
static struct stat tmp_dst_sb;
static struct stat tmp_src_sb;
if (!same)
return 1;
@@ -489,7 +494,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
return 1;
/* If neither is a symlink, then it's ok as long as they aren't
links to the same file. */
hard links to the same file. */
if (!S_ISLNK (src_sb_link->st_mode) && !S_ISLNK (dst_sb_link->st_mode))
{
if (!SAME_INODE (*src_sb_link, *dst_sb_link))
@@ -504,19 +509,25 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
}
/* It's ok to remove a destination symlink. But that works only when we
unlink before opening the destination and when they're on the same
partition. */
unlink before opening the destination and when the source and destination
files are on the same partition. */
if (x->unlink_dest_before_opening
&& S_ISLNK (dst_sb_link->st_mode))
return src_sb_link->st_dev == src_sb_link->st_dev;
return dst_sb_link->st_dev == src_sb_link->st_dev;
if (x->xstat == lstat)
{
static struct stat tmp_dst_sb;
static struct stat tmp_src_sb;
if (stat (dst_path, &tmp_dst_sb)
|| stat (src_path, &tmp_src_sb)
|| ! SAME_INODE (tmp_dst_sb, tmp_dst_sb))
if ( ! S_ISLNK (src_sb_link->st_mode))
tmp_src_sb = *src_sb_link;
else if (stat (src_path, &tmp_src_sb))
return 1;
if ( ! S_ISLNK (dst_sb_link->st_mode))
tmp_dst_sb = *dst_sb_link;
else if (stat (dst_path, &tmp_dst_sb))
return 1;
if ( ! SAME_INODE (tmp_src_sb, tmp_dst_sb))
return 1;
/* FIXME: shouldn't this be testing whether we're making symlinks? */
@@ -577,6 +588,10 @@ copy_internal (const char *src_path, const char *dst_path,
find created files so as to not copy infinitely if a directory is
copied into itself. */
/* Associate the destination path with the source device and inode
so that if we encounter a matching dev/ino pair in the source tree
we can arrange to create a hard link between the corresponding names
in the destination tree. */
earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev);
src_mode = src_sb.st_mode;
@@ -617,6 +632,14 @@ copy_internal (const char *src_path, const char *dst_path,
return 1;
}
if (S_ISDIR (src_type) && !S_ISDIR (dst_sb.st_mode))
{
error (0, 0,
_("cannot overwrite non-directory %s with directory %s"),
quote_n (0, dst_path), quote_n (1, src_path));
return 1;
}
if (!S_ISDIR (src_type))
{
if (S_ISDIR (dst_sb.st_mode))
@@ -750,8 +773,21 @@ copy_internal (const char *src_path, const char *dst_path,
directories). */
if (S_ISDIR (src_type))
{
error (0, 0, _("won't create hard link %s to directory %s"),
quote_n (0, dst_path), quote_n (1, earlier_file));
/* If src_path and earlier_file refer to the same directory entry,
then warn about copying a directory into itself. */
if (same_name (src_path, earlier_file))
{
error (0, 0, _("cannot copy a directory, %s, into itself, %s"),
quote_n (0, top_level_src_path),
quote_n (1, top_level_dst_path));
*copy_into_self = 1;
}
else
{
error (0, 0, _("will not create hard link %s to directory %s"),
quote_n (0, dst_path), quote_n (1, earlier_file));
}
goto un_backup;
}
@@ -797,7 +833,13 @@ copy_internal (const char *src_path, const char *dst_path,
/* FIXME: this is a little fragile in that it relies on rename(2)
failing with a specific errno value. Expect problems on
non-POSIX systems. */
error (0, 0, _("cannot move %s to a subdirectory of itself, %s"),
quote_n (0, top_level_src_path),
quote_n (1, top_level_dst_path));
*copy_into_self = 1;
/* FIXME-cleanup: Don't return zero here; adjust mv.c accordingly.
The only caller that uses this code (mv.c) ends up setting its
exit status to nonzero when copy_into_self is nonzero. */
return 0;
}
@@ -1161,6 +1203,17 @@ copy (const char *src_path, const char *dst_path,
int move_mode = options->move_mode;
assert (valid_options (options));
/* Record the file names: they're used in case of error, when copying
a directory into itself. I don't like to make these tools do *any*
extra work in the common case when that work is solely to handle
exceptional cases, but in this case, I don't see a way to derive the
top level source and destination directory names where they're used.
An alternative is to use COPY_INTO_SELF and print the diagnostic
from every caller -- but I don't wan't to do that. */
top_level_src_path = src_path;
top_level_dst_path = dst_path;
return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL,
options, move_mode, copy_into_self, rename_succeeded);
}

View File

@@ -142,6 +142,17 @@ int rpl_lstat PARAMS((const char *, struct stat *));
# define lstat rpl_lstat
# endif
int rename ();
/* Arrange to make rename calls go through the wrapper function
on systems with a rename function that fails for a source path
specified with a trailing slash. */
# if RENAME_TRAILING_SLASH_BUG
int rpl_rename PARAMS((const char *, const char *));
# undef rename
# define rename rpl_rename
# endif
int
copy PARAMS ((const char *src_path, const char *dst_path,
int nonexistent_dst, const struct cp_options *options,

View File

@@ -1,5 +1,5 @@
/* cp-hash.c -- file copying (hash search routines)
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
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
@@ -33,7 +33,11 @@ struct entry
{
ino_t ino;
dev_t dev;
char *node; /* Path name, or &new_file for new inodes. */
/* Destination path name (of non-directory or pre-existing directory)
corresponding to the dev/ino of a copied file, or the destination path
name corresponding to a dev/ino pair for a newly-created directory. */
char *node;
struct entry *coll_link; /* 0 = entry not occupied. */
};
@@ -46,8 +50,7 @@ struct htab
struct entry *hash[1]; /* Vector of pointers in `entry_tab'. */
};
struct htab *htab;
char new_file;
static struct htab *htab;
static char *cph_hash_insert PARAMS ((ino_t ino, dev_t dev, const char *node));
@@ -65,7 +68,7 @@ remember_created (const char *path)
return 1;
}
cph_hash_insert (sb.st_ino, sb.st_dev, &new_file);
cph_hash_insert (sb.st_ino, sb.st_dev, path);
return 0;
}

View File

@@ -1,5 +1,5 @@
/* cp.c -- file copying (main routines)
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation.
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
@@ -172,6 +172,8 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
special files like FIFOs or /dev/zero\n\
--remove-destination remove each existing destination file before\n\
attempting to open it (contrast with --force)\n\
"));
printf (_("\
--sparse=WHEN control creation of sparse files\n\
-R, --recursive copy directories recursively\n\
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\

View File

@@ -1,5 +1,5 @@
/* date - print or set the system date and time
Copyright (C) 1989-2000 Free Software Foundation, Inc.
Copyright (C) 1989-2001 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
@@ -355,6 +355,15 @@ argument must be a format string beginning with `+'."),
usage (1);
}
/* Simply ignore --rfc-822 if specified when setting the date. */
if (rfc_format && !set_date && n_args > 0)
{
error (0, 0,
_("a format string may not be specified when using\
the --rfc-822 (-R) option"));
usage (1);
}
if (set_date)
datestr = set_datestr;

176
src/ls.c
View File

@@ -1,5 +1,5 @@
/* `dir', `vdir' and `ls' directory listing programs for GNU.
Copyright (C) 85, 88, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 85, 88, 90, 91, 1995-2001 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
@@ -205,6 +205,12 @@ int rpl_lstat PARAMS((const char *, struct stat *));
# define DT_INIT(Val) /* empty */
#endif
#ifdef ST_MTIM_NSEC
# define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
#else
# define TIMESPEC_NS(timespec) 0
#endif
enum filetype
{
unknown DT_INIT (DT_UNKNOWN),
@@ -383,10 +389,11 @@ struct pending
static struct pending *pending_dirs;
/* Current time (seconds since 1970). When we are printing a file's time,
include the year if it is more than 6 months before this time. */
/* Current time in seconds and nanoseconds since 1970, updated as
needed when deciding whether a file is recent. */
static time_t current_time;
static time_t current_time = TYPE_MINIMUM (time_t);
static int current_time_ns = -1;
/* The number of digits to use for block sizes.
4, or more if needed for bigger numbers. */
@@ -648,6 +655,11 @@ static int format_needs_stat;
static int format_needs_type;
/* strftime formats for non-recent and recent files, respectively, in
-l output. */
static char const *long_time_format[2];
/* The exit status to use if we don't get any fatal errors. */
static int exit_status;
@@ -861,7 +873,6 @@ main (int argc, char **argv)
dir_defaulted = 1;
print_dir_name = 1;
pending_dirs = 0;
current_time = time ((time_t *) 0);
i = decode_switches (argc, argv);
@@ -1352,6 +1363,18 @@ decode_switches (int argc, char **argv)
sort_type = sort_time;
}
if (format == long_format)
{
if (full_time)
long_time_format[0] = long_time_format[1] =
dcgettext (NULL, "%a %b %d %H:%M:%S %Y", LC_TIME);
else
{
long_time_format[0] = dcgettext (NULL, "%b %e %Y", LC_TIME);
long_time_format[1] = dcgettext (NULL, "%b %e %H:%M", LC_TIME);
}
}
return optind;
}
@@ -1899,9 +1922,10 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
}
#if USE_ACL
files[files_index].have_acl =
(! S_ISLNK (files[files_index].stat.st_mode)
&& 4 < acl (path, GETACLCNT, 0, NULL));
if (format == long_format)
files[files_index].have_acl =
(! S_ISLNK (files[files_index].stat.st_mode)
&& 4 < acl (path, GETACLCNT, 0, NULL));
#endif
if (S_ISLNK (files[files_index].stat.st_mode)
@@ -2326,6 +2350,80 @@ print_current_files (void)
}
}
/* Return the expected number of columns in a long-format time stamp,
or zero if it cannot be calculated. */
static int
long_time_expected_width (void)
{
static int width = -1;
if (width < 0)
{
time_t epoch = 0;
struct tm const *tm = localtime (&epoch);
char const *fmt = long_time_format[0];
char initbuf[100];
char *buf = initbuf;
size_t bufsize = sizeof initbuf;
size_t len;
for (;;)
{
*buf = '\1';
len = strftime (buf, bufsize, fmt, tm);
if (len || ! *buf)
break;
buf = alloca (bufsize *= 2);
}
width = mbsnwidth (buf, len, 0);
if (width < 0)
width = 0;
}
return width;
}
/* Get the current time. */
static void
get_current_time (void)
{
#if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME
{
struct timespec timespec;
if (clock_gettime (CLOCK_REALTIME, &timespec) == 0)
{
current_time = timespec.tv_sec;
current_time_ns = timespec.tv_nsec;
return;
}
}
#endif
/* The clock does not have nanosecond resolution, so get the maximum
possible value for the current time that is consistent with the
reported clock. That way, files are not considered to be in the
future merely because their time stamps have higher resolution
than the clock resolution. */
#if HAVE_GETTIMEOFDAY
{
struct timeval timeval;
if (gettimeofday (&timeval, NULL) == 0)
{
current_time = timeval.tv_sec;
current_time_ns = timeval.tv_usec * 1000 + 999;
return;
}
}
#endif
current_time = time (NULL);
current_time_ns = 999999999;
}
static void
print_long_format (const struct fileinfo *f)
{
@@ -2345,8 +2443,8 @@ print_long_format (const struct fileinfo *f)
size_t s;
char *p;
time_t when;
int when_ns IF_LINT (= 0);
struct tm *when_local;
const char *fmt;
char *user_name;
#if HAVE_ST_DM_MODE
@@ -2363,38 +2461,18 @@ print_long_format (const struct fileinfo *f)
{
case time_ctime:
when = f->stat.st_ctime;
when_ns = TIMESPEC_NS (f->stat.st_ctim);
break;
case time_mtime:
when = f->stat.st_mtime;
when_ns = TIMESPEC_NS (f->stat.st_mtim);
break;
case time_atime:
when = f->stat.st_atime;
when_ns = TIMESPEC_NS (f->stat.st_atim);
break;
}
if (full_time)
{
fmt = _("%a %b %d %H:%M:%S %Y");
}
else
{
if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */
|| current_time < when - 60L * 60L) /* In the future. */
{
/* The file is fairly old or in the future.
POSIX says the cutoff is 6 months old;
approximate this by 6*30 days.
Allow a 1 hour slop factor for what is considered "the future",
to allow for NFS server/client clock disagreement.
Show the year instead of the time of day. */
fmt = _("%b %e %Y");
}
else
{
fmt = _("%b %e %H:%M");
}
}
p = buf;
if (print_inode)
@@ -2452,9 +2530,35 @@ print_long_format (const struct fileinfo *f)
if ((when_local = localtime (&when)))
{
while (! (s = strftime (p, buf + bufsize - p - 1, fmt, when_local)))
time_t six_months_ago;
int recent;
char const *fmt;
/* If the file appears to be in the future, update the current
time, in case the file happens to have been modified since
the last time we checked the clock. */
if (current_time < when
|| (current_time == when && current_time_ns < when_ns))
get_current_time ();
/* Consider a time to be recent if it is within the past six
months. A Gregorian year has 365.2425 * 24 * 60 * 60 ==
31556952 seconds on the average. Write this value as an
integer constant to avoid floating point hassles. */
six_months_ago = current_time - 31556952 / 2;
recent = (six_months_ago <= when
&& (when < current_time
|| (when == current_time && when_ns <= current_time_ns)));
fmt = long_time_format[recent];
for (;;)
{
char *newbuf = (char *) alloca (bufsize *= 2);
char *newbuf;
*p = '\1';
s = strftime (p, buf + bufsize - p - 1, fmt, when_local);
if (s || ! *p)
break;
newbuf = alloca (bufsize *= 2);
memcpy (newbuf, buf, p - buf);
p = newbuf + (p - buf);
buf = newbuf;
@@ -2471,7 +2575,7 @@ print_long_format (const struct fileinfo *f)
/* The time cannot be represented as a local time;
print it as a huge integer number of seconds. */
char hbuf[LONGEST_HUMAN_READABLE + 1];
int width = full_time ? 24 : 12;
int width = long_time_expected_width ();
if (when < 0)
{
@@ -3148,7 +3252,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
--block-size=SIZE use SIZE-byte blocks\n\
-B, --ignore-backups do not list implied entries ending with ~\n\
-c with -lt: sort by, and show, ctime (time of last\n\
modification of file status information)\n\
modification of file status information)\n\
with -l: show ctime and sort by name\n\
otherwise: sort by ctime\n\
-C list entries by columns\n\

View File

@@ -1,5 +1,5 @@
/* mv -- move or rename files
Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 86, 89, 90, 91, 1995-2001 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
@@ -195,9 +195,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
and failing. */
dir_to_remove = NULL;
error (0, 0,
_("cannot move %s to a subdirectory of itself, %s"),
quote_n (0, source), quote_n (1, dest));
fail = 1;
}
else if (rename_succeeded)
{
@@ -259,9 +257,6 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
if (fail)
error (0, errno, _("cannot remove %s"), quote (dir_to_remove));
}
if (copy_into_self)
fail = 1;
}
return fail;

View File

@@ -1,5 +1,5 @@
/* od -- dump files in octal and other formats
Copyright (C) 92, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 92, 1995-2001 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
@@ -225,13 +225,15 @@ static FILE *in_stream;
/* If nonzero, at least one of the files we read was standard input. */
static int have_read_stdin;
#ifdef HAVE_UNSIGNED_LONG_LONG
# define LONGEST_INTEGRAL_TYPE unsigned long long
#if HAVE_UNSIGNED_LONG_LONG
typedef unsigned long long ulonglong_t;
#else
# define LONGEST_INTEGRAL_TYPE long int
/* This is just a place-holder to avoid a few `#if' directives.
In this case, the type isn't actually used. */
typedef unsigned long int ulonglong_t;
#endif
#define MAX_INTEGRAL_TYPE_SIZE sizeof(LONGEST_INTEGRAL_TYPE)
#define MAX_INTEGRAL_TYPE_SIZE sizeof (ulonglong_t)
static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];
#define MAX_FP_TYPE_SIZE sizeof(LONG_DOUBLE)
@@ -435,19 +437,17 @@ print_long (off_t n_bytes, const char *block, const char *fmt_string)
}
}
#ifdef HAVE_UNSIGNED_LONG_LONG
static void
print_long_long (off_t n_bytes, const char *block, const char *fmt_string)
{
off_t i;
for (i = n_bytes / sizeof (unsigned long long); i > 0; i--)
for (i = n_bytes / sizeof (ulonglong_t); i > 0; i--)
{
unsigned long long tmp = *(const unsigned long long *) block;
ulonglong_t tmp = *(const ulonglong_t *) block;
printf (fmt_string, tmp);
block += sizeof (unsigned long long);
block += sizeof (ulonglong_t);
}
}
#endif
static void
print_float (off_t n_bytes, const char *block, const char *fmt_string)
@@ -1633,8 +1633,8 @@ main (int argc, char **argv)
integral_type_size[sizeof (short int)] = SHORT;
integral_type_size[sizeof (int)] = INT;
integral_type_size[sizeof (long int)] = LONG;
#ifdef HAVE_UNSIGNED_LONG_LONG
integral_type_size[sizeof (long long)] = LONG_LONG;
#if HAVE_UNSIGNED_LONG_LONG
integral_type_size[sizeof (ulonglong_t)] = LONG_LONG;
#endif
for (i = 0; i <= MAX_FP_TYPE_SIZE; i++)

View File

@@ -508,16 +508,22 @@ files, most people use the --remove option.\n\
* --------------------------------------------------------------------
*/
#if ULONG_MAX == 0xffffffff
#if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
#else
# define UINT_MAX_32_BITS 0xFFFFFFFF
#endif
#if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long word32;
#else
# if UINT_MAX == 0xffffffff
# if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned word32;
# else
# if USHRT_MAX == 0xffffffff
# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short word32;
# else
# if UCHAR_MAX == 0xffffffff
# if UCHAR_MAX == UINT_MAX_32_BITS
typedef unsigned char word32;
# else
"No 32-bit type available!"

View File

@@ -2188,7 +2188,7 @@ lacks following character offset"));
{
/* Provoke with `sort -k1.0' */
error (0, 0, _("starting field character offset \
argument to the `-k' option\nmust be positive"));
argument to the `-k' option must be positive"));
badfieldspec (argv[i]);
}
}

View File

@@ -264,12 +264,17 @@ char *alloca ();
#if ENABLE_NLS
# include <libintl.h>
# if HAVE_GETTEXT && !HAVE_DCGETTEXT && !defined dcgettext
# define dcgettext(Domain, Text, Category) Text
# endif
# define _(Text) gettext (Text)
#else
# undef bindtextdomain
# define bindtextdomain(Domain, Directory) /* empty */
# undef textdomain
# define textdomain(Domain) /* empty */
# undef dcgettext
# define dcgettext(Domainname, Text, Category) Text
# define _(Text) Text
#endif
#define N_(Text) Text

View File

@@ -1,5 +1,5 @@
/* tail -- output the last part of file(s)
Copyright (C) 1989, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 1989, 90, 91, 1995-2001 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
@@ -263,6 +263,11 @@ With no FILE, or when FILE is -, read standard input.\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
"),
DEFAULT_N_LINES, DEFAULT_N_LINES,
DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS
);
printf (_("\
If the first character of N (the number of bytes or lines) is a `+',\n\
print beginning with the Nth item from the start of each file, otherwise,\n\
print the last N items in the file. N may have a multiplier suffix:\n\
@@ -279,10 +284,7 @@ rotation). Use --follow=name in that case. That causes tail to track the\n\
named file by reopening it periodically to see if it has been removed and\n\
recreated by some other program.\n\
\n\
"),
DEFAULT_N_LINES, DEFAULT_N_LINES,
DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS
);
"));
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);

1
tests/chgrp/.cvsignore Normal file
View File

@@ -0,0 +1 @@
Makefile

View File

@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.4 gnits
TESTS = equal-x c-option
TESTS = equal-x c-option setgid
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=`pwd`/../../src:$$PATH

View File

@@ -118,7 +118,7 @@ l = @l@
AUTOMAKE_OPTIONS = 1.4 gnits
TESTS = equal-x c-option
TESTS = equal-x c-option setgid
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
PATH=`pwd`/../../src:$$PATH

View File

@@ -33,7 +33,7 @@ if test $framework_failure = 1; then
(exit 1); exit
fi
. $abs_srcdir/../sticky-check
. $abs_srcdir/../setgid-check
fail=0

73
tests/chmod/setgid Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/sh
# Make sure GNU chmod works the same way as those of Solaris, HPUX, AIX
# wrt directories with the setgid bit set.
if test "$VERBOSE" = yes; then
set -x
chmod --version
fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
pwd=`pwd`
tmp=setgid.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
# Record absolute path of srcdir and cd back to current dir.
cd $srcdir || framework_failure=1
abs_srcdir=`pwd`
cd $pwd || framework_failure=1
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
. $abs_srcdir/../setgid-check
umask 0
mkdir d || framework_failure=1
chmod g+s d 2> /dev/null ||
{
# This is required because on some systems (at least NetBSD 1.4.2A),
# it may happen that when you create a directory, its group isn't one
# to which you belong. When that happens, the above chmod fails. So
# here, upon failure, we try to set the group, then rerun the chmod command.
group=${FETISH_GROUP-`(id -ng || /usr/xpg4/bin/id -ng) 2>/dev/null`}
if test "$group"; then
chgrp "$group" d || framework_failure=1
chmod g+s d || framework_failure=1
else
framework_failure=1
fi
}
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
chmod 755 d
# To be compatible with chmod from other vendors,
# GNU chmod must not reset a directory's setgid bit.
# The latest POSIX draft (d5) allows either behavior. It says:
#
# For regular files, for each bit set in the octal number
# corresponding to the set-user-ID-on-execution or the
# set-group-ID-on-execution, bits shown in the following table shall
# be set; if these bits are not set in the octal number, they are
# cleared. For other file types, it is implementation-defined whether
# or not requests to set or clear the set-user-ID-on-execution or
# set-group-ID-on-execution bits are honored.
# FIXME: consider changing GNU chmod to work like other versions of chmod.
# For now, this test simply confirms the existing behavior.
p=`ls -ld d|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
(exit $fail); exit

View File

@@ -4,7 +4,8 @@ AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = \
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
perm cp-HL special-bits link dir-rm-dest cp-parents
perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
dir-vs-file into-self
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
MAKE=$(MAKE) \

View File

@@ -121,7 +121,8 @@ AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = \
backup-1 no-deref-link1 no-deref-link2 no-deref-link3 backup-is-src \
same-file cp-mv-backup symlink-slash slink-2-slink fail-perm dir-slash \
perm cp-HL special-bits link dir-rm-dest cp-parents
perm cp-HL special-bits link dir-rm-dest cp-parents deref-slink \
dir-vs-file into-self
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \

View File

@@ -21,11 +21,13 @@ cd $srcdir || framework_failure=1
abs_srcdir=`pwd`
cd $pwd || framework_failure=1
. $abs_srcdir/../sticky-check
. $srcdir/../envvar-check
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
. $abs_srcdir/../setgid-check
mkdir foo bar || framework_failure=1
mkdir -p a/b/c d e || framework_failure=1

32
tests/cp/deref-slink Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
# Demonstrate bug when using -d with an existing destination file
# that is a symlink.
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
pwd=`pwd`
tmp=FIXME.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch f slink-target || framework_failure=1
ln -s slink-target slink || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
cp -d f slink || fail=1
(exit $fail); exit

37
tests/cp/dir-vs-file Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
# A directory may not replace an existing file.
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
. $srcdir/../envvar-check
pwd=`pwd`
tmp=dirvfile.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
touch file || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
# In 4.0.35, this cp invocation silently succeeded.
cp -R dir file 2>/dev/null && fail=1
# Make sure file is not replaced with a directory.
# In 4.0.35, it was.
test -f file || fail=1
(exit $fail); exit

45
tests/cp/into-self Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# Confirm that copying a directory into itself gets a proper diagnostic.
# In 4.0.35 and earlier, `mkdir dir && cp -R dir dir' would produce this:
# cp: won't create hard link `dir/dir/dir' to directory `'
# Now it gives this:
# cp: can't copy a directory `dir' into itself `dir/dir'
if test "$VERBOSE" = yes; then
set -x
cp --version
fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
pwd=`pwd`
tmp=into-self.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
# This command should exit nonzero.
cp -R dir dir 2> out && fail=1
cat > exp <<\EOF
cp: cannot copy a directory, `dir', into itself, `dir/dir'
EOF
#'
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -2,7 +2,7 @@
# Set `groups' to a space-separated list of at least two groups of which
# the user is a member.
groups=${FETISH_GROUPS-`id -nG 2>/dev/null`}
groups=${FETISH_GROUPS-`(id -nG || /usr/xpg4/bin/id -nG) 2>/dev/null`}
case "$groups" in
*' '*) ;;
*) cat <<EOF 1>&2

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -27,7 +27,7 @@ if test $framework_failure = 1; then
(exit 1); exit
fi
. $abs_srcdir/../sticky-check
. $abs_srcdir/../setgid-check
fail=0

View File

@@ -27,7 +27,7 @@ if test $framework_failure = 1; then
(exit 1); exit
fi
. $abs_srcdir/../sticky-check
. $abs_srcdir/../setgid-check
fail=0

View File

@@ -1,9 +1,10 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = i-2 mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
TESTS = i-2 mv-special-1 into-self into-self-2 into-self-3 into-self-4 \
backup-is-src \
i-1 hard-link-1 force partition-perm to-symlink dir-file diag \
part-symlink part-rename
part-symlink part-rename trailing-slash
EXTRA_DIST = $(TESTS) setup
TESTS_ENVIRONMENT = \

View File

@@ -118,9 +118,10 @@ l = @l@
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = i-2 mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
TESTS = i-2 mv-special-1 into-self into-self-2 into-self-3 into-self-4 \
backup-is-src \
i-1 hard-link-1 force partition-perm to-symlink dir-file diag \
part-symlink part-rename
part-symlink part-rename trailing-slash
EXTRA_DIST = $(TESTS) setup

37
tests/mv/into-self-4 Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
# confirm that `mv symlink symlink' doesn't remove symlink
# Based on an example from David Luyer.
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
. $srcdir/../envvar-check
pwd=`pwd`
tmp=mv-slink2.$$
trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch file || framework_failure=1
ln -s file s || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
# This must fail.
mv s s 2> /dev/null && fail=1
# But the symlink, s, must not be removed.
# Before 4.0.36, `s' would have been removed.
test -f s || fail=1
(exit $fail); exit

31
tests/mv/trailing-slash Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
# On some operating systems, e.g. SunOS-4.1.1_U1 on sun3x,
# rename() doesn't accept trailing slashes.
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
pwd=`pwd`
tmp=mv-tslash.$$
trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $tmp && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
. $srcdir/../envvar-check
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir foo || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
fail=0
mv foo/ bar || fail=1
(exit $fail); exit

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

21
tests/setgid-check Normal file
View File

@@ -0,0 +1,21 @@
# -*- sh -*-
# Disable the current test if the working directory seems to have
# the setgid bit set.
# This test should be run in the temporary directory that ends
# up being removed via the trap commands.
cwd_is_setgid=no
setgid_tmpdir=setgid-$$
(umask 77; mkdir $setgid_tmpdir)
p=`ls -ld $setgid_tmpdir|sed 's/ .*//'`
rmdir $setgid_tmpdir
case $p in drwx------);; *) cwd_is_setgid=yes;; esac
if test $cwd_is_setgid = yes; then
cat <<EOF >&2
$0: Since it looks like you're running this test in a directory with
the setgid bit set, we're skipping this test.
EOF
(exit 77); exit
fi

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.