new snapshot available: coreutils-7.5.76-1c0ec

2009-09-08 Thread Jim Meyering
Here's another snapshot, prior to coreutils-7.6.
We've inherited quite a few changes from gnulib,
including one to fix the Solaris build failure.

coreutils snapshot:
  http://meyering.net/cu/coreutils-ss.tar.gz  9.6 MB
  http://meyering.net/cu/coreutils-ss.tar.xz  4.0 MB
  http://meyering.net/cu/coreutils-ss.tar.gz.sig
  http://meyering.net/cu/coreutils-ss.tar.xz.sig
aka
  http://meyering.net/cu/coreutils-7.5.76-1c0ec.tar.gz
  http://meyering.net/cu/coreutils-7.5.76-1c0ec.tar.xz

Changes in coreutils since 7.5.65-61cc6:

Jim Meyering (9):
  build: update gnulib submodule to latest
  tests: tail-2/infloop-1: avoid rare test failure on a busy system
  tests: ls/color-clear-to-eol: append NL to accommodate old sed
  tests: misc/cat-buf: clean up syntax
  tail: don't give up on inotify mode for an already-ignored "-"
  tail: ignore -f for piped-stdin, as POSIX requires
  tail: syntax-only: use "false", rather than equivalent, 0
  tail: make the new piped-stdin test as portable as the old one
  * gnulib: Update submodule to latest.

Pádraig Brady (3):
  tests: tail-2/flush-initial should not rely on stdbuf
  tests: address a race condition in misc/cat-buf
  tests: tail-2/assert: reduce risk of race condition


Changes in gnulib since 7.5.65-61cc6:

* gnulib c46ae39...2c90f1a (23):
  > fstatat: fix compilation on Solaris
  > rename: modernize replacement
  > stdio: sort witness names
  > getcwd: minor cleanups
  > openat: provide more convenience names
  > doc: fix comments in recent patches
  > faccessat, symlinkat: continue cleanup of previous patch
  > Remove dependency from unistd_h.m4, sys_stat_h.m4, fcntl_h.m4 to openat.m4.
  > Remove unneeded gl_MODULE_INDICATOR invocation.
  > Set errno to ENOSYS when a function is entirely unsupported.
  > Mention affected platforms.
  > Fix indentation.
  > For NULL, include , not .
  > Work around a glibc bug in strtok_r.
  > exclude: minor fix
  > bootstrap: improve error message
  > Update copyright year.
  > symlinkat: new module
  > test-openat-safer: add more checks * tests/test-openat-safer.c (main): 
Check more code paths.
  > syntax-check: detect unnecessary inclusion of openat.h
  > Support towlower and towupper.
  > Fix bug occurring when converting invalid input.
  > Test indirect conversion as well.




fsetxattr() fails on a writable descriptor?

2009-09-08 Thread Pádraig Brady
fsetxattr() is failing for me when the permissions are readonly
but the descriptor is writable as demonstrated by the program below.
I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
and linux-2.6.30.5-43.fc11.i586

Is this expected?

cheers,
Pádraig.

#include 
#include 
#include 
#include 
#include 
#include 

int main(void)
{
int wfd;
if ((wfd=open("writable", O_CREAT|O_WRONLY|O_EXCL, S_IRUSR)) == -1)
fprintf(stderr, "open('writable') error [%m]\n");
if (write(wfd, "data", 1) == -1)
fprintf(stderr, "write() error [%m]\n");
if (fsetxattr(wfd, "user.test", "test", 4, 0) == -1)
fprintf(stderr, "fsetxattr() error [%m]\n");
}




Re: new snapshot available: coreutils-7.5.76-1c0ec

2009-09-08 Thread Sven Joachim
On 2009-09-08 13:55 +0200, Jim Meyering wrote:

> Here's another snapshot, prior to coreutils-7.6.

All tests passed on Debian sid i386, including the (very) expensive and
root checks. :-)

Cheers,
   Sven




Re: new snapshot available: coreutils-7.5.76-1c0ec

2009-09-08 Thread Jim Meyering
Sven Joachim wrote:
> On 2009-09-08 13:55 +0200, Jim Meyering wrote:
>> Here's another snapshot, prior to coreutils-7.6.
>
> All tests passed on Debian sid i386, including the (very) expensive and
> root checks. :-)

Nice.  Thanks!




Re: new snapshot available: coreutils-7.5.76-1c0ec

2009-09-08 Thread Pádraig Brady
Jim Meyering wrote:
> Here's another snapshot, prior to coreutils-7.6.
> We've inherited quite a few changes from gnulib,
> including one to fix the Solaris build failure.

   Passed Skipped Failed
  \-
Fedora core 5 x86 |   348  42  0
Fedora 11 x86 |   343  47  0
Solaris 10 x86|   328  61  1
Solaris 9 x86 |   314  61 15

Note the solaris systems were on nfs

new solaris 10 failure in cp/into-self:
  > diff -u exp out
  --- exp Tue Sep  8 15:29:02 2009
  +++ out Tue Sep  8 15:26:48 2009
  @@ -4,5 +4,6 @@
   2
   cp: cannot copy a directory, `dir', into itself, `dir/dir'
   3
  +cp: cannot create directory `dir/dir/dir/.../dir/dir': File name too long
   cp: cannot copy a directory, `dir', into itself, `dir/dir'
   4

solaris 9 failures:
  misc/help-version
  install/basic-1
  install/create-leading
  install/install-C
  install/strip-program
  ln/misc
  cp/backup-dir
  cp/cp-parents
  cp/file-perm-race
  cp/parent-perm
  cp/parent-perm-race
  cp/preserve-2
  cp/reflink-perm
  cp/src-base-dot
  mv/part-symlink
All due to: facl(4, SETACL, 3, 0x08047458) -> EOPNOTSUPP





Re: new snapshot available: coreutils-7.5.76-1c0ec

2009-09-08 Thread Pádraig Brady
rerunning on local file systems:

   Passed Skipped Failed
  \-
Fedora core 5 x86 |   348  42  0
Fedora 11 x86 |   343  47  0
Solaris 10 x86|   328  62  0
Solaris 9 x86 |   327  62  1

solaris 9 failure was:
  mv/part-symlink
   mv loc_reg rem_sl
 mv: preserving permissions for `rem_sl': Invalid argument
   facl(4, SETACL, 4, 0x08097FA0) -> Err#22 EINVAL

cheers,
Pádraig.




Bug#545721: info: No menu item `mktemp invocation' in node `(coreutils.info.gz)Top'.

2009-09-08 Thread jidanni
X-debbugs-cc: bug-coreutils@gnu.org
Package: coreutils
Version: 7.5-3
Severity: minor

$ man mktemp|col -b|grep -C 3 'info coreutils'
   The  full  documentation for mktemp is maintained as a Texinfo manual.  
If the info and mktemp programs are prop
   erly installed at your site, the command

  info coreutils 'mktemp invocation'

   should give you access to the complete manual.

$ info coreutils 'mktemp invocation' 1>&-
info: No menu item `mktemp invocation' in node `(coreutils.info.gz)Top'.

P.S., the man page should say what directory the temp file ends up in if
no options are given. Maybe it currently does but one has to look among
the options to find out.

Also mention what "Create a temporary file or directory, safely" means.
Guaranteed not to overwrite any other existing file perhaps, and ...






wishlist: give cut(1) option to split fields on whitespace

2009-09-08 Thread Mike Coleman
It would be really nice if cut(1) could split fields using whitespace
as a separator (as many other text tools do).  Currently I use

$ awk '{ print $3, $4, $5 }'

for this sort of thing, but it seems relatively klutzy, as opposed to (say)

$ cut -w -f 3-5

Mike




Re: fsetxattr() fails on a writable descriptor?

2009-09-08 Thread Christoph Hellwig
On Tue, Sep 08, 2009 at 12:29:49PM +0100, P??draig Brady wrote:
> fsetxattr() is failing for me when the permissions are readonly
> but the descriptor is writable as demonstrated by the program below.
> I've tried this on ext3 and ext4 with libattr-2.4.43-3.fc11.i586
> and linux-2.6.30.5-43.fc11.i586

That's not XFS specifci behaviour.  For all xattr operations, fd-based
or not we always do the full permission checks, and have done so since
day one.  Check the routined xattr_permission in fs/xattr.c of the
kernel tree.  It seems a bit unusual, but I'm not sure changing it now
is a good idea - the xattr support has been around for a long time.





extend inotify to support file descriptors in addition to paths

2009-09-08 Thread Giuseppe Scrivano
Hello,

at the moment inotify permits to add new files to be watched using their
path.  There are situations where the file path is not know but a
descriptor is available.  It would be desiderable to have the
possibility to use the inotify system even in these (rare) cases.

A concrete example of application that can take advantage of this
possibility is GNU tail.  GNU tail, since version 7.5, is using inotify
to watch changes on files.  This command will make `tail' sleeps until
some events are catched:

 tail -qf foo bar baz

Inotify can't be used when stdin is watched too:

tail -qf boo bar - < baz

While the user gets the same result, internally it is a completely
different thing because polling is done on stdin instead of graciously
sleep until something is ready.
I don't know if it is possible to obtain the former result when the fd
is know but the path isn't.


My proposal is to extend inotify adding a new syscall:

   long sys_inotify_add_watch_fd(int wd, int fd, u32 mask);

in this way the same mechanism can be used indifferently either a
descriptor or on a path is provided.

What do you think about this idea?  Is there another way to get the same
result?

Regards,
Giuseppe


P.S.
In the attached patch I changed the syscalls table only for x86.

>From 6f3340347fb5d26000bec3a0a9cd8ef59c710922 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano 
Date: Tue, 8 Sep 2009 23:40:03 +0200
Subject: [PATCH] Add new syscall \`inotify_add_watch_fd'.

It makes possible to register a file to be watched by inotify using
its file descriptor instead of its path.
---
 arch/x86/kernel/syscall_table_32.S |1 +
 fs/notify/inotify/inotify_user.c   |   54 ++--
 include/linux/syscalls.h   |3 ++
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/syscall_table_32.S 
b/arch/x86/kernel/syscall_table_32.S
index d51321d..46eb4ac 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -336,3 +336,4 @@ ENTRY(sys_call_table)
.long sys_pwritev
.long sys_rt_tgsigqueueinfo /* 335 */
.long sys_perf_counter_open
+   .long sys_inotify_add_watch_fd
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index dcd2040..53f3c41 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -747,16 +747,64 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char 
__user *, pathname,
 
/* create/update an inode mark */
ret = inotify_update_watch(group, inode, mask);
-   if (unlikely(ret))
-   goto path_put_and_out;
 
-path_put_and_out:
path_put(&path);
 fput_and_out:
fput_light(filp, fput_needed);
return ret;
 }
 
+SYSCALL_DEFINE3(inotify_add_watch_fd, int, wd, int, fd,u32, mask)
+{
+   struct fsnotify_group *group;
+   struct inode *inode;
+   struct path path;
+   struct file *filp;
+   struct file *filp2;
+   int ret, fput_needed, fput2_needed;
+   unsigned flags = 0;
+
+   filp = fget_light(wd, &fput_needed);
+   if (unlikely(!filp))
+   return -EBADF;
+
+   /* verify that this is indeed an inotify instance */
+   if (unlikely(filp->f_op != &inotify_fops)) {
+   ret = -EINVAL;
+   goto fput_and_out;
+   }
+
+   if (!(mask & IN_DONT_FOLLOW))
+   flags |= LOOKUP_FOLLOW;
+   if (mask & IN_ONLYDIR)
+   flags |= LOOKUP_DIRECTORY;
+
+   filp2 = fget_light(fd, &fput2_needed);
+
+   if (unlikely(!filp2)){
+   ret = -EBADF;
+   goto fput_and_out;
+   }
+
+   /* you can only watch an inode if you have read permissions on it */
+   ret = inode_permission(filp2->f_path.dentry->d_inode, MAY_READ);
+   if (ret)
+   goto fput2_and_out;
+
+   /* inode held in place by reference to path; group by fget on fd */
+   inode = filp2->f_path.dentry->d_inode;
+   group = filp->private_data;
+
+   /* create/update an inode mark */
+  ret = inotify_update_watch(group, inode, mask);
+
+fput2_and_out:
+   fput_light(filp2, fput2_needed);
+fput_and_out:
+   fput_light(filp, fput_needed);
+   return ret;
+}
+
 SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
 {
struct fsnotify_group *group;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 80de700..0833b1d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -761,4 +761,7 @@ int kernel_execve(const char *filename, char *const argv[], 
char *const envp[]);
 asmlinkage long sys_perf_counter_open(
struct perf_counter_attr __user *attr_uptr,
pid_t pid, int cpu, int group_fd, unsigned long flags);
+
+
+asmlinkage long sys_inotify_add_watch_fd(int wd, int fd, u32 mask);
 #endif
-- 
1.6.3.3