ls -l behavior on directories without execute permission

2013-03-06 Thread sachidananda urs
Hi,

When ls -l is run on a directory which has no execute permissions, ls
fails but the return value is 0.

bash-4.2$ ls -ld /tmp/foo/
drw-r-xr-x  3 sac  wheel  512 Mar  6 18:11 /tmp/foo/
bash-4.2$ ls -l /tmp/foo/
bash-4.2$ echo $?
0
bash-4.2$

I see in the traverse function:

chp = fts_children(ftsp, ch_options);
saved_errno = errno;
display(p, chp);

/*
 * On fts_children() returning error do recurse to see
 * the error.
 */
if (!f_recursive  !(chp == NULL  saved_errno != 0))
(void)fts_set(ftsp, p, FTS_SKIP);
break;

On the failure of fts_children function shouldn't we be setting rval =
1 and break?

Since we do not anyway want to continue on a directory without execute
permission as we do not get the stat information to long list the
contents?

Let me know if the understanding is right, I will send a patch.

-sac



Re: write(2) man page

2013-03-04 Thread Sachidananda Urs

On 02/24/2013 05:34 PM, Sachidananda wrote:

Ted,

On Sunday 24 February 2013 10:10 AM, Ted Unangst wrote:

On Sun, Feb 24, 2013 at 09:12, Sachidananda wrote:

Also, for the record, it's open that seeks to the end.  You can open a
file with O_APPEND and seek back to the beginning, and write will not
seek to the end again.

My observation is, if I open(2) the file with O_APPEND it seeks to the
end. And I lseek back to the beginning and write(2) to it, write does
seek back to the end and write the data at the end.

No, I apologize.  I'm the one who's wrong.  The O_APPEND flag is
sticky, and continues to affect the file even after seeking. This
probably is worth documenting.  The current write man page is
misleading, even.  Checking the source, pwrite is not affected by the
flag.  That'd be worth mentioning too.


Attaching patch for review.

Hi,

Any thoughts on this?

-sac