Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"The only way for a reporter to look at a politician is down." -- H. L. Mencken


devel / comp.unix.shell / Re: Command 'strings' reading (not) standard input

SubjectAuthor
* Command 'strings' reading (not) standard inputKaz Kylheku
+* Command 'strings' reading (not) standard inputSpiros Bousbouras
|`- Command 'strings' reading (not) standard inputJanis Papanagnou
`* Command 'strings' reading (not) standard inputGeoff Clare
 `- Command 'strings' reading (not) standard inputChristian Weisgerber

1
Re: Command 'strings' reading (not) standard input

<20220809130917.374@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6600&group=comp.unix.shell#6600

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: Command 'strings' reading (not) standard input
Date: Tue, 9 Aug 2022 20:15:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <20220809130917.374@kylheku.com>
References: <tcu8re$1f6op$1@dont-email.me>
Injection-Date: Tue, 9 Aug 2022 20:15:59 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="c80481950bc8dbe1047a4a5cd55e8d7f";
logging-data="1566434"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sICfORHLnWf+oxykLo7fvYXsL66x3mWE="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:ZKahzTnOvncTDaa/0tH/F6HWUJc=
 by: Kaz Kylheku - Tue, 9 Aug 2022 20:15 UTC

On 2022-08-09, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> Thanks to process substitution in newer shells I can write, e.g.,
> strings <( zcat file.gz ) | ...
>
> I am wondering, though, whether there's a reason why 'strings' is
> not defined to support (additionally) filter calling semantics
> ...(binary stream)... | strings | ...(text stream)...

Think that it's not there because POSIX doesn't require it, I checked
POSIX. In POSIX, I found this:

"If the first argument is '-', the results are unspecified."

Aha, so implementations of strings are permitted (encouraged, I might
say) to support standard in reading via the - convention.

The wording probably exists because some strings implementations
do and some do not?

The strings from GNU Bintutils 2.30 does handle stdin---and does not
like the - argument; go figure.

Deliberate use of cat;

$ cat /proc/self/environ | strings | head -4
CLUTTER_IM_MODULE=xim
XDG_MENU_PREFIX=gnome-
LANG=en_CA.UTF-8
DISPLAY=:1

What "strings" are you looking at? Maybe it handles - as a way of
specifying stdin. (Still, if you want that in a portable
script, PITA).

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: Command 'strings' reading (not) standard input

<aeRP=f7EwlPz5EIbz@bongo-ra.co>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6604&group=comp.unix.shell#6604

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.shell
Subject: Re: Command 'strings' reading (not) standard input
Date: Wed, 10 Aug 2022 08:27:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <aeRP=f7EwlPz5EIbz@bongo-ra.co>
References: <tcu8re$1f6op$1@dont-email.me> <20220809130917.374@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Aug 2022 08:27:22 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="73a4b2b3edb6ba0b2bfb78384b7528a5";
logging-data="1873717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WFjcYBue+wp+1jeg3mvaH"
Cancel-Lock: sha1:zvi/HarS+sz0i7mwXeeOpOKwIQ8=
In-Reply-To: <20220809130917.374@kylheku.com>
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Wed, 10 Aug 2022 08:27 UTC

On Tue, 9 Aug 2022 20:15:59 -0000 (UTC)
Kaz Kylheku <480-992-1380@kylheku.com> wrote:
> On 2022-08-09, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> > Thanks to process substitution in newer shells I can write, e.g.,
> > strings <( zcat file.gz ) | ...
> >
> > I am wondering, though, whether there's a reason why 'strings' is
> > not defined to support (additionally) filter calling semantics
> > ...(binary stream)... | strings | ...(text stream)...
>
> Think that it's not there because POSIX doesn't require it, I checked
> POSIX. In POSIX, I found this:
>
> "If the first argument is '-', the results are unspecified."
>
> Aha, so implementations of strings are permitted (encouraged, I might
> say) to support standard in reading via the - convention.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html :

strings [-a] [-t format] [-n number] [file...]
[...]

INPUT FILES
The input files named by the utility arguments or the standard
input shall be regular files of any format.

So a file argument is optional and it explicitly says that reading
from standard input is allowed. But I'm not sure what it means for
the standard input to be a regular file.

> The wording probably exists because some strings implementations
> do and some do not?
>
> The strings from GNU Bintutils 2.30 does handle stdin---and does not
> like the - argument; go figure.

[...]

--
vlaho.ninja/prog

Re: Command 'strings' reading (not) standard input

<tcvskr$1pk5s$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6608&group=comp.unix.shell#6608

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: Command 'strings' reading (not) standard input
Date: Wed, 10 Aug 2022 11:09:47 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <tcvskr$1pk5s$2@dont-email.me>
References: <tcu8re$1f6op$1@dont-email.me> <20220809130917.374@kylheku.com>
<aeRP=f7EwlPz5EIbz@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Aug 2022 09:09:47 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="36dd0e9b16a7cf2815e9b7db1df5f489";
logging-data="1888444"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Vxl2cM/84asSM/u5LhsoT"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:g2v+LNJNTUr3iQtPSUSVG+8jFbw=
In-Reply-To: <aeRP=f7EwlPz5EIbz@bongo-ra.co>
 by: Janis Papanagnou - Wed, 10 Aug 2022 09:09 UTC

On 10.08.2022 10:27, Spiros Bousbouras wrote:
>
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html :
>
> strings [-a] [-t format] [-n number] [file...]

I was fooled by my man page; the POSIX syntax is clear here.

Janis

Re: Command 'strings' reading (not) standard input

<a4lcsi-l2h.ln1@ID-313840.user.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6609&group=comp.unix.shell#6609

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: geoff@clare.See-My-Signature.invalid (Geoff Clare)
Newsgroups: comp.unix.shell
Subject: Re: Command 'strings' reading (not) standard input
Date: Wed, 10 Aug 2022 13:32:42 +0100
Lines: 37
Message-ID: <a4lcsi-l2h.ln1@ID-313840.user.individual.net>
References: <tcu8re$1f6op$1@dont-email.me> <20220809130917.374@kylheku.com>
Reply-To: netnews@gclare.org.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net x3yjI4g6Rb9VyfvYEMpebg1m55PACTM2i9tPXJfGvSQgNpjdrw
X-Orig-Path: ID-313840.user.individual.net!not-for-mail
Cancel-Lock: sha1:/w12z5lSt6e+MyB87BHBopmrLa8=
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
 by: Geoff Clare - Wed, 10 Aug 2022 12:32 UTC

Kaz Kylheku wrote:

> On 2022-08-09, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>>
>> I am wondering, though, whether there's a reason why 'strings' is
>> not defined to support (additionally) filter calling semantics
>> ...(binary stream)... | strings | ...(text stream)...
>
> Think that it's not there because POSIX doesn't require it, I checked
> POSIX. In POSIX, I found this:
>
> "If the first argument is '-', the results are unspecified."
>
> Aha, so implementations of strings are permitted (encouraged, I might
> say) to support standard in reading via the - convention.

That text is there because with some versions of strings, "strings -"
means the same as "strings -a".

If you give an operand of '-' that isn't the first argument, e.g.
"strings -- -", then POSIX actually requires it to read from a
file named '-'. However, this doesn't match existing practice so
it is probably an oversight in POSIX (my guess, as a result of the
"first argument is '-'" text being there).

Anyway, the text most relevant to Janis's question is in the OPERANDS
section:

The following operand shall be supported:

file
A pathname of a regular file to be used as input. If no file
operand is specified, the strings utility shall read from the
standard input.

--
Geoff Clare <netnews@gclare.org.uk>

Re: Command 'strings' reading (not) standard input

<slrntf7fua.2uge.naddy@lorvorc.mips.inka.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6611&group=comp.unix.shell#6611

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!news.in-chemnitz.de!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: naddy@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: Command 'strings' reading (not) standard input
Date: Wed, 10 Aug 2022 14:25:14 -0000 (UTC)
Message-ID: <slrntf7fua.2uge.naddy@lorvorc.mips.inka.de>
References: <tcu8re$1f6op$1@dont-email.me> <20220809130917.374@kylheku.com>
<a4lcsi-l2h.ln1@ID-313840.user.individual.net>
Injection-Date: Wed, 10 Aug 2022 14:25:14 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="96783"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Wed, 10 Aug 2022 14:25 UTC

On 2022-08-10, Geoff Clare <geoff@clare.See-My-Signature.invalid> wrote:

> file
> A pathname of a regular file to be used as input. If no file
> operand is specified, the strings utility shall read from the
> standard input.

As indeed it has been doing since it appeared in 3.0BSD in 1980.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor