[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: findutils & textutils updates/bug fixes
From: |
Padraig Brady |
Subject: |
Re: findutils & textutils updates/bug fixes |
Date: |
Fri, 15 Jun 2001 15:15:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux 2.4.0-ac4 i686; en-US; rv:0.9.1) Gecko/20010607 |
Thanks for the reply.
Kevin Dalley wrote:
#1 sounds like a good idea.
(trivial) patch attached
to apply:
cd findutils-4.1.7; patch -p1 < find_device.diff
#2 seems reasonable as well.
will clean up (small) patch and send
I'm not sure about #3 yet. That changes things somewhat. Let me
think about it.
I can do it if you want. I see it as being very important
as it greatly simlifies many operations.
I'm trying to fix a number of bugs in findutils, and
have an alpha release available in
ftp://alpha.gnu.org/gnu/findutils-4.1.7.tar.gz
I'll consider adding features in a while.
Thanks for the suggestions.
Padraig Brady <address@hidden> writes:
Hi,
I've a few small patches here which I think are definitely required.
1: findutils
a: find (%D printf specifier added) which prints the device id
associated
with a file. This (in conjunction with the inode number) allows you
to uniquely identify any file on the system, which is
useful/required
for many applications.
b: xargs doesn't ignore "empty" arguments when -0 used (I.E. '\0' is
delimiter).
You can test this like:
address@hidden:~$ echo -ne "1\n\n\n2" | xargs -n1 | od -t x1
0000000 31 0a 32 0a
address@hidden:~$ echo -ne "1\000\000\0002" | xargs -0 -n1 | od
-t x1
0000000 31 0a 0a 0a 32 0a
As you can see the first command works as expected, whereas the
second doesn't.
In summary multiple consequtive '\0's should be squeezed to 1 '\0'
c: Related to b: xargs should have an option to group arguments passed
to commands
by 2 or more delimeters, i.e: you should be able to do:
address@hidden:~$ echo -ne "1\n2\n3\n\na\nb\nc\n" | xargs -nn
1 2 3
a b c
address@hidden:~$
Padraig.
diff -aru -x *.o findutils-4.1.7/doc/find.texi findutils-pb/doc/find.texi
--- findutils-4.1.7/doc/find.texi Sun May 20 21:39:37 2001
+++ findutils-pb/doc/find.texi Fri Jun 15 14:54:04 2001
@@ -1144,6 +1144,9 @@
@item %d
File's depth in the directory tree; files named on the command line
have a depth of 0.
address@hidden %D
+File's device number (in decimal); Useful in conjunction with inode
+number to uniquely identify files.
@item %F
Type of the filesystem the file is on; this value can be used for
@samp{-fstype} (@pxref{Directories}).
diff -aru -x *.o findutils-4.1.7/find/parser.c findutils-pb/find/parser.c
--- findutils-4.1.7/find/parser.c Sun May 20 21:39:37 2001
+++ findutils-pb/find/parser.c Fri Jun 15 13:01:01 2001
@@ -1358,7 +1358,7 @@
if (*scan2 == '.')
for (scan2++; ISDIGIT (*scan2); scan2++)
/* Do nothing. */ ;
- if (strchr ("abcdfFgGhHiklmnpPstuU", *scan2))
+ if (strchr ("abcdDfFgGhHiklmnpPstuU", *scan2))
{
segmentp = make_segment (segmentp, format, scan2 - format,
(int) *scan2);
@@ -1422,6 +1422,7 @@
case 'b': /* size in 512-byte blocks */
case 'c': /* ctime in `ctime' format */
case 'C': /* ctime in user-specified strftime format */
+ case 'D': /* filesystem id */
case 'F': /* filesystem type */
case 'G': /* GID number */
case 'g': /* group name */
diff -aru -x *.o findutils-4.1.7/find/pred.c findutils-pb/find/pred.c
--- findutils-4.1.7/find/pred.c Sun May 20 21:39:37 2001
+++ findutils-pb/find/pred.c Fri Jun 15 13:24:28 2001
@@ -566,6 +566,10 @@
case 'd': /* depth in search tree */
fprintf (fp, segment->text, curdepth);
break;
+ case 'D': /* filesystem id */
+ fprintf (fp, segment->text,
+ human_readable ((uintmax_t) stat_buf->st_dev, hbuf, 1, 1));
+ break;
case 'f': /* basename of path */
fprintf (fp, segment->text, base_name (pathname));
break;