install: check if file exists before creating dirs

2003-07-05 Thread Dan Jacobson
$ install -D blaaa /tmp/caa/bb/vv 
install: cannot stat `blaaa': No such file or directory
$ ls -l /tmp/caa/bb/ -d
drwxr-xr-x2 jidanni  jidanni  1024 2003-07-05 12:59 /tmp/caa/bb/

it made the directories anyway.  it should see if everything is ok first.


___
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils


Patch to ls: avoind auto-mounting.

2003-07-05 Thread Joao Luis Meloni Assirati

Hello,

The attached patch to coreutils implements a new command line option
'--nslt' that stands for never stat link targets. It is to be used in
conjunction with -F and --color to avoid that the targets of links being
listed get stat-ed. This occours in two situations:

1. 'ls --color' tries to determine if a link is broken (orphan)
2. 'ls --color -l' or 'ls -F -l' try to determine which kind of file is
   pointed to by a link.

This behavior is bad when the link points to a location that is mounted by
auto-mounters as, in this case, the location will be mounted.

Typical usage of this new option is by an alias

alias ls='ls -F --color=auto --nslt'

I hope the patch is acceptable. If not, please let me know which
modifications are necessary.

Regards,
Joao Luis M. Assirati.

Index: src/ls.c
===
RCS file: /cvsroot/coreutils/coreutils/src/ls.c,v
retrieving revision 1.331
diff -u -r1.331 ls.c
--- src/ls.c17 Jun 2003 18:13:23 -  1.331
+++ src/ls.c5 Jul 2003 01:15:36 -
@@ -599,6 +599,11 @@

 static int really_all_files;

+/* Nonzero means that link targets will not be stated
+   which occours when using -F and/or --color  */
+
+static int never_stat_link_targets;
+
 /* A linked list of shell-style globbing patterns.  If a non-argument
file name matches any of these patterns, it is omitted.
Controlled by -I.  Multiple -I options accumulate.
@@ -694,6 +699,7 @@
   FORMAT_OPTION,
   FULL_TIME_OPTION,
   INDICATOR_STYLE_OPTION,
+  NEVER_STAT_LINK_TARGETS,
   QUOTING_STYLE_OPTION,
   SHOW_CONTROL_CHARS_OPTION,
   SI_OPTION,
@@ -730,6 +736,7 @@
   {indicator-style, required_argument, 0, INDICATOR_STYLE_OPTION},
   {dereference, no_argument, 0, 'L'},
   {literal, no_argument, 0, 'N'},
+  {nslt, no_argument, 0, NEVER_STAT_LINK_TARGETS},
   {quote-name, no_argument, 0, 'Q'},
   {quoting-style, required_argument, 0, QUOTING_STYLE_OPTION},
   {recursive, no_argument, 0, 'R'},
@@ -1626,6 +1633,10 @@
   indicator_style_types);
  break;

+case NEVER_STAT_LINK_TARGETS:
+  never_stat_link_targets = 1;
+  break;
+
case QUOTING_STYLE_OPTION:
  set_quoting_style (NULL,
 XARGMATCH (--quoting-style, optarg,
@@ -2418,26 +2429,29 @@
  get_link_name (path, files[files_index]);
  linkpath = make_link_path (path, files[files_index].linkname);

- /* Avoid following symbolic links when possible, ie, when
-they won't be traced and when no indicator is needed. */
- if (linkpath
-  (indicator_style != none || check_symlink_color)
-  stat (linkpath, linkstats) == 0)
-   {
- files[files_index].linkok = 1;
-
- /* Symbolic links to directories that are mentioned on the
-command line are automatically traced if not being
-listed as files.  */
- if (!explicit_arg || format == long_format
- || !S_ISDIR (linkstats.st_mode))
-   {
- /* Get the linked-to file's mode for the filetype indicator
-in long listings.  */
- files[files_index].linkmode = linkstats.st_mode;
- files[files_index].linkok = 1;
-   }
-   }
+ if (never_stat_link_targets)
+   files[files_index].linkok = 1;
+  else
+   /* Avoid following symbolic links when possible, ie, when
+  they won't be traced and when no indicator is needed. */
+   if (linkpath
+(indicator_style != none || check_symlink_color)
+stat (linkpath, linkstats) == 0)
+ {
+   files[files_index].linkok = 1;
+
+   /* Symbolic links to directories that are mentioned on the
+  command line are automatically traced if not being
+  listed as files.  */
+   if (!explicit_arg || format == long_format
+   || !S_ISDIR (linkstats.st_mode))
+ {
+   /* Get the linked-to file's mode for the filetype indicator
+  in long listings.  */
+   files[files_index].linkmode = linkstats.st_mode;
+   files[files_index].linkok = 1;
+ }
+ }
  if (linkpath)
free (linkpath);
}
@@ -3791,6 +3805,8 @@
   fputs (_(\
   -f do not sort, enable -aU, disable -lst\n\
   -F, --classify append indicator (one of */=@|) to entries\n\
+  --nslt never stat link targets; disable orphan link\n\
+   detection and target classification\n\
   --format=WORD  across -x, commas -m, horizontal -x, long -l,\n\
single-column -1, verbose -l, vertical -C\n\
   

Re: remove argument limits to ls

2003-07-05 Thread Dan Jacobson
 aren't argument limits old fashioned?

P Every kernel (note, that's kernel, not ls) has them.

hmmm, maybe error messages could steer the blame better, as all some
of us recall is some commands had old fashioned argument limits.


___
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils


Adding numerical suffixes to split

2003-07-05 Thread Jesse Kornblum

My apologies for taking so long to write back. I'm in the middle of switching 
locations.

Paul, you mentioned using csplit, which already has the ability to create numerical 
suffixes. This is good, and I must sheepishly admit I hadn't looked at csplit, but it 
does not meet my needs. csplit can't split a file based on the size, only the number 
of lines. I need a tool that can split files at the 2GB limit in order to fit into a 
FAT32 filesystem.

Next, several people have asked why we don't use a script to automate this task. The 
problem is two-fold:

1. The majority of our users are not *nix-saavy enough to write scripts.

2. The files we are working with will become evidence to be used in criminal 
proscecutions. As a result, we need to ensure that we handle the evidence as little as 
possible. (Think of a detective taking a murder weapon from the crime scene. We're 
doing the same thing) The more commands that need to be executed, the greater the 
possibility that a mistake will be made and then the truth will never be known. By 
'mistake', I don't mean the erasure of data. If the data has been handled in an 
inappropriate maner, even if only for a short time, it may be inadmissible in federal 
court. 


As I see it, there are two happy solutions to this problem:

1. Add support for size-based splitting to csplit

2. Add numerical suffixes to split

Given that the functionality for numerical suffixies already exists in csplit, why 
can't that be added to regular split? Wouldn't this be a trivial operation?


-- 
Jesse Kornblum, Captain, USAF
United States Naval Academy
[EMAIL PROTECTED]




___
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils


Re: Bug in expand command.

2003-07-05 Thread Paul Eggert
That doesn't look like a bug to me.  For example, the first line
of hints.txt contains

1 . SPACE TAB T

so there are three columns before the tab, which means that expand -t1
and expand -t2 should behave the same.  Perhaps you didn't notice the
SPACE?


___
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils


Re: Adding numerical suffixes to split

2003-07-05 Thread Paul Eggert
Jesse Kornblum [EMAIL PROTECTED] writes:

 2. The files we are working with will become evidence to be used in
 criminal proscecutions.

If I were a criminal defense lawyer attacking your use of 'split' on
technical grounds, I'd ask why you require a particular implementation
of 'split' with nonstandard extensions.

I'd have a harder time attacking your methods if they could be
executed on any implementation of 'split' conforming to the standard
specification for 'split'
http://www.opengroup.org/onlinepubs/007904975/utilities/split.html
(this is ISO/IEC 9945:2002, a formal international standard).  If your
procedures stick to the formal standard, anybody can check your work
by running your procedures on any standard implementation (Solaris or
Tru64, say).  This would provide an extra check that the prosecution
isn't incorrectly relying on some bug in the coreutils implementation
of 'split'.


 The more commands that need to be executed, the greater the
 possibility that a mistake will be made

True, but the number of commands that you'd have to put into a script
ought to be significantly less than the number of lines of code in
'split' that you'd have to change.

Also, you ought to have a script anyway -- since 'split' alone doesn't
solve your problem, and since your users are not experts -- so it
shouldn't be a major objection that you use a script.


 Given that the functionality for numerical suffixies already exists
 in csplit, why can't that be added to regular split? Wouldn't this
 be a trivial operation?

This issue is really up to the coreutils maintainer, but if you supply
a high-quality patch with a ChangeLog entry, I think you'll have a
better chance of it getting accepted.  Please see
http://mail.gnu.org/archive/html/bug-coreutils/2003-07/msg0.html
for an example of what a patch should look like.  Also, I suggest that
you ponder the suggestions and comments in
http://mail.gnu.org/archive/html/bug-coreutils/2003-07/msg1.html.


___
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils