Jim Meyering [Thu, 21 Oct 2004 10:37:18 +0000 (10:37 +0000)]
Correct my patch of 2004-10-18.
(rm): Destroy the saved_cwd here (via cwd_state),
if necessary, not in remove_dir. Otherwise, removing multiple
`.'-relative nonempty directories no longer worked.
Jim Meyering [Mon, 18 Oct 2004 08:59:12 +0000 (08:59 +0000)]
Plug a leak that would cause rm or a cross-device mv to fail when
operating on too many command-line-specified nonempty directories.
(remove_dir): Destroy the `struct saved_cwd' on the
top of the stack before returning. This usually closes the file
descriptor that was used to return to the original working directory.
Reported by Cyril Bouthors in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
Jim Meyering [Mon, 18 Oct 2004 08:19:26 +0000 (08:19 +0000)]
(validate_file_name): Give a more descriptive
diagnostic when pathconf fails. This also avoids an unwarranted
warning from gcc-3.3.5 about a format not being a string literal.
Paul Eggert [Mon, 18 Oct 2004 06:30:49 +0000 (06:30 +0000)]
(AUTHORS): Add self.
Change "path" to "file name" whenever possible.
Remove usage comment, as it was a duplication of the code or doc.
Include <wchar.h> if available.
(mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
(NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
pathconf_wrapper, portable_chars, dir_ok): Remove.
(NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
(pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
(portable_chars_only): New arg FILELEN.
Don't assume ASCII; we might be on an EBCDIC host.
Don't assume unibyte locale in diagnostic.
(component_start, component_len): New functions.
(validate_file_name): Renamed from validate_path. All uses changed.
Pretty much a complete rewrite.
Don't make copy of file arg. Always append trailing slash to
pathconf arg, just in case it's a symlink (this is pure paranoia;
we don't know of any hosts where the trailing slash is required).
Use size_t instead of long int when possible.
Avoid need to call pathconf in most practical cases.
Don't use euidaccess several times to test searchability;
just use lstat once. Reword diagnostic to put the (often very long)
file names last.
Paul Eggert [Mon, 18 Oct 2004 06:29:51 +0000 (06:29 +0000)]
(pathchk invocation): Overall lengths are
OS limits, not file system limits. Component length checks
apply to all components, not merely to existing ones. Say
that nonexistent names are not errors. For -p, omit all
checks based on the underlying file system, not merely length
checks. Explain what the portabile file name character set is.
Jim Meyering [Wed, 13 Oct 2004 19:25:30 +0000 (19:25 +0000)]
(fts_read): When about to fail (by returning NULL) due
to a failed fchdir or failed fts_safe_changedir call, set
`sp->fts_cur = p'. Do this by removing the explicit `return NULL;'
statements and setting p->fts_errno so execution falls through
to the common-case code below. Otherwise, after such a failure,
calling fts_close would attempt to free an already-freed buffer.
Reported by Luis Lopez Lopez in http://bugs.debian.org/276352.
Paul Eggert [Mon, 11 Oct 2004 23:43:49 +0000 (23:43 +0000)]
(Special built-in utilities): New node.
(printf invocation): builtin -> built-in, for consistency
with POSIX terminology.
(test invocation, pwd invocation):
Use specific rather than generic language to warn about
built-in commands.
(chroot invocation, env invocation, nice invocation, nohup invocation):
Warn that command must not be a special built-in.
(env invocation): Warn about environment variables with unusual
spellings, or duplicates.
Paul Eggert [Sun, 26 Sep 2004 22:56:38 +0000 (22:56 +0000)]
Add "ls --hide".
(file_ignored): Renamed from file_interesting, with
inverted return value. Accept the file name, not a struct dirent *.
All uses changed. Avoid the expense of calling fnmatch if the
file is ignorable due to leading '.'.
(all_files, really_all_files): Removed; replaced by:
(ignore): New variable. All uses changed.
(IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
New constants.
(hide_patterns): New variable.
(long_options, decode_switches, file_ignored, usage):
Add support for --hide.
(patterns_match): New function.
(usage): Replace "hide" with "ignore" in explanation, to avoid
confusion.
Paul Eggert [Sun, 26 Sep 2004 07:06:07 +0000 (07:06 +0000)]
(gobble_file, print_long_format): Don't assume that
human-readable output has a byte count equal to its column width;
this isn't always true in locales where the radix character is not
'.' or ','.
(format_user_or_group): Revamp code to match the above fix;
this avoids the (very faint) possibility of integer overflow.