Re: a patch to fix sh_stat on SunOS

2016-08-20 Thread Dmitry Goncharov
On Thu, Aug 11, 2016 at 07:52:51AM -0400, Chet Ramey wrote:
> On 8/10/16 5:38 PM, Dmitry Goncharov wrote:
> 
> >> > does "If any file argument to one of the primaries is of the form
> > 
> >> > /dev/fd/n, then file descriptor n is checked.".
> > 
> > 
> >> It seems like a documentation error.
> > 
> > What should the man page say instead?
> 
> Probably something close to what the current text about using /dev/fd in
> redirections says, maybe:

Do you mean current text in process substitution?

The current text in redirection says
"/dev/fd/fd
If fd is a valid integer, file descriptor fd is duplicated."

There is asymmetry
>/dev/fd/6 redirects to fd 6, while
test -p /dev/fd/6 tests file "/dev/fd/6".


> 
> \fBBash\fP handles filenames of the form \fI/dev/fd\fP specially when they
> are used as arguments to unary operators.
> If the operating system on which \fBbash\fP is running provides these
> special files, bash will use them; otherwise if
> any \fIfile\fP argument to one of the primaries is of the form
> \fI/dev/fd/n\fP, then file descriptor \fIn\fP is checked.

With this new contract how can the user write portable bash code which tests if
a fd refers to a pipe?

regards, Dmitry



fix a memory leak in netopen

2016-08-20 Thread Dmitry Goncharov
Good morning.

The patch in the attachment fixes a memory leak in netopen.

regards, Dmitry

diff --git a/lib/sh/netopen.c b/lib/sh/netopen.c
index 736d413..e584548 100644
--- a/lib/sh/netopen.c
+++ b/lib/sh/netopen.c
@@ -304,6 +304,7 @@ netopen (path)
   if (t == 0)
 {
   internal_error (_("%s: bad network path specification"), path);
+  free (np);
   return -1;
 }
   *t++ = '\0';