bug-bash@gnu.org

2024-03-29 Thread Reuben
$ echo cat /dev/stderr > bug
$ bash bug 2>&-
cat /dev/stderr

calling bash script 2>&- on linux
seems to make /dev/stderr refer to script,
though &2 seems unaffected.
using 2>&- inside script does not trigger this bug.
i assume it is a bug and not 'historical compatibility'.
the bug does not seem to appear in bash on openbsd.
the bug does not seem to appear in dash or pdksh.

---

$ bash -version
GNU bash, version 5.2.26(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later


This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ uname -srvmo
Linux 6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Feb 23 18:27:29
UTC 2024 x86_64 GNU/Linux

---

$ bash -version
GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later


This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Linux 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64
GNU/Linux


---



bug-bash@gnu.org

2024-03-29 Thread Greg Wooledge
On Fri, Mar 29, 2024 at 09:02:12PM +1100, Reuben wrote:
> $ echo cat /dev/stderr > bug
> $ bash bug 2>&-
> cat /dev/stderr

I don't understand what you were trying to do here.

> calling bash script 2>&- on linux
> seems to make /dev/stderr refer to script,
> though &2 seems unaffected.
> using 2>&- inside script does not trigger this bug.
> i assume it is a bug and not 'historical compatibility'.
> the bug does not seem to appear in bash on openbsd.
> the bug does not seem to appear in dash or pdksh.

As a first guess, bash was given the name of a file to read as a script,
so it opened that file using the first available file descriptor.  Since
you had already closed FD 2 before invoking bash, FD 2 was the first
available, and therefore the script was opened as FD 2.

To me, this seems like a case of "Doctor, it hurts when I bend my arm
this way."  Maybe Chet will disagree.



Re: install-headers stdckdint.h error

2024-03-29 Thread Chet Ramey

On 3/28/24 9:54 PM, Grisha Levit wrote:

The addition of stdckdint.h to CREATED_HEADERS in Makefile.in leads to
an error when installing loadable builtins on platforms that provide
the header:


Thanks for the report. What platform are you using that provides that
header?

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: install-headers stdckdint.h error

2024-03-29 Thread Grisha Levit
On Fri, Mar 29, 2024, 09:37 Chet Ramey  wrote:

> On 3/28/24 9:54 PM, Grisha Levit wrote:
> > The addition of stdckdint.h to CREATED_HEADERS in Makefile.in leads to
> > an error when installing loadable builtins on platforms that provide
> > the header:
>
> Thanks for the report. What platform are you using that provides that
> header?
>

This was on aarch64 Android with clang 18.

>


bug-bash@gnu.org

2024-03-29 Thread Chet Ramey

On 3/29/24 9:32 AM, Greg Wooledge wrote:

On Fri, Mar 29, 2024 at 09:02:12PM +1100, Reuben wrote:

$ echo cat /dev/stderr > bug
$ bash bug 2>&-
cat /dev/stderr


I don't understand what you were trying to do here.


calling bash script 2>&- on linux
seems to make /dev/stderr refer to script,
though &2 seems unaffected.
using 2>&- inside script does not trigger this bug.
i assume it is a bug and not 'historical compatibility'.
the bug does not seem to appear in bash on openbsd.
the bug does not seem to appear in dash or pdksh.


As a first guess, bash was given the name of a file to read as a script,
so it opened that file using the first available file descriptor.  Since
you had already closed FD 2 before invoking bash, FD 2 was the first
available, and therefore the script was opened as FD 2.


This is pretty much right. cat's behavior depends on how the OS handles
/dev/stderr. On Linux, the open succeeds and the read returns the script
data. On FreeBSD, the open succeeds and the read returns 0.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [PATCH 12/13] doc/bash.1: Fix *roff style nit.

2024-03-29 Thread Chet Ramey

On 3/28/24 5:12 PM, G. Branden Robinson wrote:

While font mounting position 3 is usually assigned a bold typeface, it
seems a bit fragile to not explicitly ask for bold.  The concept of
mounting positions is also not something man page authors typically need
to think about.


It's been like that for 30 years. I assume it was because it solved some
problem I was having in 1994.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



OpenPGP_signature.asc
Description: OpenPGP digital signature