Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16816
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | worley@alum.mit.edu (Dale R. Worley) |
| Newsgroups | gnu.bash.bug |
| Subject | Re: How do we intercept file saving or output to stdout directly |
| Date | Wed, 26 Aug 2020 00:01:26 -0400 |
| Lines | 48 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1278.1598414497.2469.bug-bash@gnu.org> (permalink) |
| References | <1598249852364-0.post@n7.nabble.com> <87a6yinjhl.fsf@hobgoblin.ariadne.com> |
| NNTP-Posting-Host | lists.gnu.org |
| X-Trace | usenet.stanford.edu 1598414498 28182 209.51.188.17 (26 Aug 2020 04:01:38 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | Bug-bash@gnu.org |
| To | almahdi <budikusasi@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1598414489; bh=aRBkjk4yiqA33WmMsCCXD9+CMdwqqxSBF+ZiV5sOiLY=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=pYd7MtCAi4QUIW0hQLNrVy/exbvo0NIUCCqGs8igIN3vSD04V5h09pDqr8yf9Mmtk iK304LJ4gPtJ6V6+GXyjIqF/eX6LWKP4Irhjk5UHdHoGCPFL1jZOJmOJeMgPliU+GN Wlw5SosEqs6ACP2vM86+1qgo/3Ec92TF4m6osRvH35qw/wcwRazteuSUC2lRT63mmk tjnho5XPlr8mu8xCSVLr7dSJWHaHlTlPBR7pjrXEG7Gpgtk1lYCe0eWFLFlk3OIYP8 tOw2ulUM4+yGudfy6AEmVmC3AHE5ghmoySN/nDcQKnsUTxgbQXz2RQGZ+i/475QRwC jVHnE0EGqTHZw== |
| X-Xfinity-VMeta | sc=0.00;st=legit |
| X-Authentication-Warning | hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f |
| In-Reply-To | <1598249852364-0.post@n7.nabble.com> (budikusasi@gmail.com) |
| Received-SPF | softfail client-ip=2001:558:fe21:29:69:252:207:40; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-08v.sys.comcast.net |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/08/26 00:01:29 |
| X-ACL-Warn | Detected OS = ??? |
| X-Spam_score_int | -11 |
| X-Spam_score | -1.2 |
| X-Spam_bar | - |
| X-Spam_report | (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no |
| X-Spam_action | no action |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <87a6yinjhl.fsf@hobgoblin.ariadne.com> |
| Xref | csiph.com gnu.bash.bug:16816 |
Show key headers only | View raw
almahdi <budikusasi@gmail.com> writes:
> How do we intercept and redirect file saving or output to stdout directly in
> bash, just like e.g
>
> xkbcomp $DISPLAY
>
> will output and generated a file, but what needed is to put it directly to
> stream of stdout which will be piped once.
...
> $ xkbcomp $DISPLAY /dev/stdout
> Error: Cannot open "/dev/stdout" to write keyboard description
> Exiting
Normally, that should work.
But I get the same error message as you do. I did a trace on xkbcom and
I see at the end:
open("/dev/stdout", O_WRONLY|O_CREAT|O_EXCL, 0666) = -1 EEXIST (File exists)
write(2, "Error: ", 18Error: ) = 18
write(2, "Cannot open \"/dev/stdout\" to wri"..., 56Cannot open "/dev/stdout" to write keyboard description
) = 56
The open() is done with the O_EXCL flag. Reading the manual page
open(2), I see that O_EXCL requires that the open() call creates the
file.
It's not clear why xkbcomp has this behavior, but it seems likely that
this is done for a specific reason. So you will have to ask whoever
maintains it.
I don't see any option that overrides this behavior.
However, as Robert said, many programs handle an argument "-" specially
as a reference to stdin or stdout. And it turns out that (my version
of) xkbcomp does so:
$ xkbcomp $DISPLAY -
xkb_keymap {
xkb_keycodes "evdev+aliases(qwerty)" {
minimum = 8;
maximum = 255;
<ESC> = 9;
<AE01> = 10;
...
Dale
Back to gnu.bash.bug | Previous | Next | Find similar
Re: How do we intercept file saving or output to stdout directly worley@alum.mit.edu (Dale R. Worley) - 2020-08-26 00:01 -0400
csiph-web