Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Unix will self-destruct in five seconds... 4... 3... 2... 1...


devel / comp.unix.shell / Re: Restore the destroyed disk image partition table by dd.

SubjectAuthor
* Re: Restore the destroyed disk image partition table by dd.hongy...@gmail.com
+* Re: Restore the destroyed disk image partition table by dd.Ben Bacarisse
|`* Re: Restore the destroyed disk image partition table by dd.Keith Thompson
| +- Re: Restore the destroyed disk image partition table by dd.joerg
| `* Re: Restore the destroyed disk image partition table by dd.hongy...@gmail.com
|  +* Re: Restore the destroyed disk image partition table by dd.Helmut Waitzmann
|  |`- Re: Restore the destroyed disk image partition table by dd.hongy...@gmail.com
|  `- Re: Restore the destroyed disk image partition table by dd.Keith Thompson
`* Re: Restore the destroyed disk image partition table by dd.joerg
 `* Re: Restore the destroyed disk image partition table by dd.Helmut Waitzmann
  `- Re: Restore the destroyed disk image partition table by dd.joerg

1
Re: Restore the destroyed disk image partition table by dd.

<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3702&group=comp.unix.shell#3702

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:ae85:: with SMTP id x127mr22137958qke.436.1619005817814;
Wed, 21 Apr 2021 04:50:17 -0700 (PDT)
X-Received: by 2002:a37:45c7:: with SMTP id s190mr22343369qka.111.1619005817569;
Wed, 21 Apr 2021 04:50:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 21 Apr 2021 04:50:17 -0700 (PDT)
In-Reply-To: <83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=158.101.136.126; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 158.101.136.126
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de> <f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de> <1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de> <db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de> <74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
Subject: Re: Restore the destroyed disk image partition table by dd.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 21 Apr 2021 11:50:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Wed, 21 Apr 2021 11:50 UTC

On Sunday, April 18, 2021 at 12:32:35 PM UTC+8, Helmut Waitzmann wrote:
> "hongy...@gmail.com" <hongy...@gmail.com>:
> >On Sunday, April 18, 2021 at 3:24:13 AM UTC+8, Helmut Waitzmann wrote:
>
> >> For example:
> >>
> >> printf \''\\%.4o'\''\n' 4 8 9 16 64 128 255
> >
> >It seems to me that this form is more obscure than the following
> >alternative one supplied by me.
> >
> >>
> >> will output the following lines:
> >>
> >> '\0004'
> >> '\0010'
> >> '\0011'
> >> '\0020'
> >> '\0100'
> >> '\0200'
> >> '\0377'
> >
> >I tried with the following form and obtain the same results as
> >yours:
> >
> >$ printf ''\''\%.4o'\''\n' 4 8 9 16 64 128 255
> At least according to the POSIX standard, '\%' in the formatting
> parameter of 'printf' causes undefined behavior. The posixly way of
> letting the formatting parameter output one backslash is to provide
> two:
> printf ''\''\\%.4o'\''\n' 4 8 9 16 64 128 255
> In the shell command line, the leading two apostrophes denote an
> empty string, which, when prepended to an non‐empty string, just
> disappears, so they may be omitted:
> printf \''\\%.4o'\''\n' 4 8 9 16 64 128 255
> If you prefer escaping (using a backslash) over quoting (using a
> pair of apostrophes) in the shell command line you can do
> printf \'\\\\%.4o\'\\n 4 8 9 16 64 128 255
> instead.

Another question I still not so clear is the following description from `man 1 printf':

%b ARGUMENT as a string with '\' escapes interpreted, except that
octal escapes are of the form \0 or \0NNN

As we can see, here we use the form '\0NNN' to denote the octal represented byte value. But as the man page excerpted above said: '... octal escapes are of the form \0 or \0NNN', so, how to use the form \0 as the octal escape?

Regards,
HY

> >I've checked the manual page of 'od', but doesn't have so much
> >experience in the selection of its various options.
> >
> >> So the WWW gave bad advice to you, because it didn't supply the
> >> '-v' option and supplied '-t' 'x4' rather than '-t' 'x1', causing
> >> the little‐endian‐big‐endian trouble.
> >
> >The endian conversion problem is architecture and OS platform
> >dependent which only happens when the data is written into ram. I'm
> >not sure if there is/are some convenient *nix tool(s) to check it.
> I'm not sure either.
>
>
> The conversion problem happens when bytes are combined into larger
> units. If 'od' is given the parameters '-t' 'x1' rather than '-t'
> 'x4' then there is no combining, hence no conversion problem: 'od'
> just outputs the sedecimal representation of the raw bytes in the
> same order as it reads them.
>
> And as there is no need to combine the 4 partuuid bytes into one
> 4‐byte number in order to copy them from one disk image to an other,
> the endianess problem can easily be avoided.
>
>
> Just look at the 'od' options one after the other:
>
>
> I don't want line suppression to happen. => I supply the '-v'
> option.
>
> I don't want address information to be printed. => I supply the
> '-A' option together with its parameter 'n'.
>
> I don't want the endianness problem to happen. => I supply the '-t'
> option together with its parameter 'x1' rather than with 'x4'.
>
> That's all of it.
> >> # Print the sedecimal numbers, one per line, converted to
> >>
> >
> >Should be wording as 'sedecimal' or 'hexadecimal'?
> >
> I prefer 'sedecimal', from Latin 'sedecim', sixteen. YMMV.

Re: Restore the destroyed disk image partition table by dd.

<878s5bv563.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3703&group=comp.unix.shell#3703

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Wed, 21 Apr 2021 19:55:16 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <878s5bv563.fsf@bsb.me.uk>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de>
<f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de>
<1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de>
<db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de>
<74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="a3393fd15f6a3a5968975cc2c7dd40ea";
logging-data="7377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UFL+fGF6dqiatv+wXm6BfOe212W7PD1U="
Cancel-Lock: sha1:ieiN1O2jim9YIE2Hy/mEPKuBMZM=
sha1:P+II/J9pwVHUlA9poOncRVwLk0c=
X-BSB-Auth: 1.cf9d03dc5f248d719f80.20210421195516BST.878s5bv563.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 21 Apr 2021 18:55 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> Another question I still not so clear is the following description
> from `man 1 printf':
>
> %b ARGUMENT as a string with '\' escapes interpreted, except that
> octal escapes are of the form \0 or \0NNN
>
>
> As we can see, here we use the form '\0NNN' to denote the octal
> represented byte value. But as the man page excerpted above said:
> '... octal escapes are of the form \0 or \0NNN', so, how to use the
> form \0 as the octal escape?

You just write \0:

printf "a\0b" | xargs -n1 -0 echo

The manual is being pedantic. Octal escapes start \0 and that applies
to a lone \0. The 0 is therefore an octal number. It make difference,
of course, because 0 has the same value no matter what base is assumed,
but computer people like this sort of thing. (Never ask "do you want
red or white?" at the computing lab's Christmas party, even if you are
holding a bottle of each. Everyone will just say "yes".)

--
Ben.

Re: Restore the destroyed disk image partition table by dd.

<s5q1eg$pqa$1@news.dns-netz.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3704&group=comp.unix.shell#3704

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!.POSTED!not-for-mail
From: joe...@schily.net
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Wed, 21 Apr 2021 20:20:32 -0000 (UTC)
Message-ID: <s5q1eg$pqa$1@news.dns-netz.com>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com> <74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com> <83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de> <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: eJxdjcEKAiEYhM/1FD+eCtLsb+mQCBu9QtFZVMzF/V1Wl6inz64Nc5jDNzPkX0U4Kpx8/QibRwVTLjVS4MbavFDVbMh+Dn2xz5jeonFMrVcph/CDnKlGMzx1HTIFo4mJt5EpmUi18Jo1W4pvnZ7+jxjs4eHdDvAAl2kGlC2gPDcfEbhsgs39dt1+ATV2ND8=
Cancel-Lock: sha1:XchG3egsLjq6Zk3h0y4K63CfrRM=
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
X-Abuse-Contact: "abuse@dns-netz.com"
 by: joe...@schily.net - Wed, 21 Apr 2021 20:20 UTC

In article <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>,
hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:

>Another question I still not so clear is the following description from `man 1 printf':
>
> %b ARGUMENT as a string with '\' escapes interpreted, except that
> octal escapes are of the form \0 or \0NNN
>
>
>As we can see, here we use the form '\0NNN' to denote the octal represented byte value. But as the man page excerpted above said: '...
>octal escapes are of the form \0 or \0NNN', so, how to use the form \0 as the octal escape?

The standard says that \0 followed by a non-octal digit is a nul char.

\0 followed by up to 3 octal digits is also valid.

But be careful,

printf '%b\n' 'ab\0cd'

is not supported corectly by all printf(1) implementations.

In special dash(1) is affected.

--
EMail:joerg@schily.net Jörg Schilling D-13353 Berlin
Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/

Re: Restore the destroyed disk image partition table by dd.

<87zgxrb9v4.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3705&group=comp.unix.shell#3705

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Wed, 21 Apr 2021 14:34:07 -0700
Organization: None to speak of
Lines: 47
Message-ID: <87zgxrb9v4.fsf@nosuchdomain.example.com>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de>
<f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de>
<1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de>
<db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de>
<74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<878s5bv563.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="b6f3801cd047deba4da7f8eba8de94c2";
logging-data="26905"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KGse2JYY8gPGMXDqnKKCB"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Cancel-Lock: sha1:yYZusJvt2zAIlWuQuLWAB3Cbblo=
sha1:EbZK5LDJFpM3io2DqRssBi5KcUI=
 by: Keith Thompson - Wed, 21 Apr 2021 21:34 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> "hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:
>> Another question I still not so clear is the following description
>> from `man 1 printf':
>>
>> %b ARGUMENT as a string with '\' escapes interpreted, except that
>> octal escapes are of the form \0 or \0NNN
>>
>>
>> As we can see, here we use the form '\0NNN' to denote the octal
>> represented byte value. But as the man page excerpted above said:
>> '... octal escapes are of the form \0 or \0NNN', so, how to use the
>> form \0 as the octal escape?
>
> You just write \0:
>
> printf "a\0b" | xargs -n1 -0 echo
>
> The manual is being pedantic. Octal escapes start \0 and that applies
> to a lone \0. The 0 is therefore an octal number. It make difference,
> of course, because 0 has the same value no matter what base is assumed,
> but computer people like this sort of thing. (Never ask "do you want
> red or white?" at the computing lab's Christmas party, even if you are
> holding a bottle of each. Everyone will just say "yes".)

It's not just being pedantic, it's incorrect. It implies that \0 has to
be followed by exactly 0 or 3 octal digits. In fact, it can be followed
by 0, 1, 2, or 3 octal digits. The info documentation ("info coreutils
printf") is correct, as is the POSIX specification. Quoting the info
manual:

• An additional directive ‘%b’, prints its argument string with ‘\’
escapes interpreted in the same way as in the FORMAT string,
except that octal escapes are of the form ‘\0OOO’ where OOO is 0
to 3 octal digits. If ‘\OOO’ is nine-bit value, ignore the
ninth bit. If a precision is also given, it limits the number of bytes
printed from the converted string.

So for example, the man page implies that
printf "%b" "\01x"
prints a null character, the digit '1', and the letter 'x'. In fact it
prints character 1 (Ctrl-A) and the letter 'x'.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Re: Restore the destroyed disk image partition table by dd.

<s5q66f$c8d$1@news.dns-netz.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3706&group=comp.unix.shell#3706

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!.POSTED!not-for-mail
From: joe...@schily.net
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Wed, 21 Apr 2021 21:41:35 -0000 (UTC)
Message-ID: <s5q66f$c8d$1@news.dns-netz.com>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com> <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com> <878s5bv563.fsf@bsb.me.uk> <87zgxrb9v4.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: eJxdjcEKAiEURdf1FQ9XBWmjJcGIMNEvFK3FETOcp4wOUV+fbburuzjnXnSvwkYsFF39MJsmBTmVGtBTY21asGryTG72Q7GPEN+scUStVzF5/4NGU40mXEh5IgomEyJtIzmagLXQmjRZimvOgP9HBPZwd+MOBIdznkF0rQjeH3l/kEC7FtjcrpftFzaHNEg=
Cancel-Lock: sha1:F/NFm/r3kObNlGtzsa6VHQHTRFc=
X-Abuse-Contact: "abuse@dns-netz.com"
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
 by: joe...@schily.net - Wed, 21 Apr 2021 21:41 UTC

In article <87zgxrb9v4.fsf@nosuchdomain.example.com>,
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

>> You just write \0:
>>
>> printf "a\0b" | xargs -n1 -0 echo
>>
>> The manual is being pedantic. Octal escapes start \0 and that applies
>> to a lone \0. The 0 is therefore an octal number. It make difference,
>> of course, because 0 has the same value no matter what base is assumed,
>> but computer people like this sort of thing. (Never ask "do you want
>> red or white?" at the computing lab's Christmas party, even if you are
>> holding a bottle of each. Everyone will just say "yes".)
>
>It's not just being pedantic, it's incorrect. It implies that \0 has to
>be followed by exactly 0 or 3 octal digits. In fact, it can be followed
>by 0, 1, 2, or 3 octal digits. The info documentation ("info coreutils
>printf") is correct, as is the POSIX specification. Quoting the info

Be careful, the octal escape for printf arguments is \ followed by 1..3 octal
digits, while the %b format argument is \0 followed by 0..3 octal digits.

Some printf implementations do not handle that correctly.

--
EMail:joerg@schily.net Jörg Schilling D-13353 Berlin
Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/

Re: Restore the destroyed disk image partition table by dd.

<83sg3jff6g.fsf@helmutwaitzmann.news.arcor.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3707&group=comp.unix.shell#3707

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!tNUTLOPypmZ99vEO5vHUQQ.user.gioia.aioe.org.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Thu, 22 Apr 2021 00:25:43 +0200
Organization: Aioe.org NNTP Server
Lines: 33
Message-ID: <83sg3jff6g.fsf@helmutwaitzmann.news.arcor.de>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<s5q1eg$pqa$1@news.dns-netz.com>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
NNTP-Posting-Host: tNUTLOPypmZ99vEO5vHUQQ.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Cancel-Lock: sha1:TWCbVyuNRrhpWt75zuhfp8AVc7g=
Mail-Copies-To: nobody
 by: Helmut Waitzmann - Wed, 21 Apr 2021 22:25 UTC

joerg@schily.net:

>But be careful,
>
> printf '%b\n' 'ab\0cd'
>
>is not supported corectly by all printf(1) implementations.
>
>In special dash(1) is affected.

… in some legacy version of Debian: 

Debian 6:

dash -c -- '"$@"' dash printf '%b\n' 'ab\0cd' |
od -A n -t c

yields

a b \n

Debian 10 (which is the current stable version):

dash -c -- '"$@"' dash printf '%b\n' 'ab\0cd' |
od -A n -t c

yields

a b \0 c d \n

Re: Restore the destroyed disk image partition table by dd.

<bbd67f4e-6ded-4639-a6ee-fa29038f78e1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3708&group=comp.unix.shell#3708

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ac8:555a:: with SMTP id o26mr213350qtr.303.1619046733059;
Wed, 21 Apr 2021 16:12:13 -0700 (PDT)
X-Received: by 2002:a05:620a:218b:: with SMTP id g11mr641386qka.292.1619046732886;
Wed, 21 Apr 2021 16:12:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 21 Apr 2021 16:12:12 -0700 (PDT)
In-Reply-To: <87zgxrb9v4.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.120; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.120
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de> <f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de> <1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de> <db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de> <74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de> <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<878s5bv563.fsf@bsb.me.uk> <87zgxrb9v4.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bbd67f4e-6ded-4639-a6ee-fa29038f78e1n@googlegroups.com>
Subject: Re: Restore the destroyed disk image partition table by dd.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 21 Apr 2021 23:12:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Wed, 21 Apr 2021 23:12 UTC

On Thursday, April 22, 2021 at 5:34:11 AM UTC+8, Keith Thompson wrote:
> Ben Bacarisse <ben.u...@bsb.me.uk> writes:
> > "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >> Another question I still not so clear is the following description
> >> from `man 1 printf':
> >>
> >> %b ARGUMENT as a string with '\' escapes interpreted, except that
> >> octal escapes are of the form \0 or \0NNN
> >>
> >>
> >> As we can see, here we use the form '\0NNN' to denote the octal
> >> represented byte value. But as the man page excerpted above said:
> >> '... octal escapes are of the form \0 or \0NNN', so, how to use the
> >> form \0 as the octal escape?
> >
> > You just write \0:
> >
> > printf "a\0b" | xargs -n1 -0 echo
> >
> > The manual is being pedantic. Octal escapes start \0 and that applies
> > to a lone \0. The 0 is therefore an octal number. It make difference,
> > of course, because 0 has the same value no matter what base is assumed,
> > but computer people like this sort of thing. (Never ask "do you want
> > red or white?" at the computing lab's Christmas party, even if you are
> > holding a bottle of each. Everyone will just say "yes".)
> It's not just being pedantic, it's incorrect. It implies that \0 has to
> be followed by exactly 0 or 3 octal digits. In fact, it can be followed
> by 0, 1, 2, or 3 octal digits. The info documentation ("info coreutils
> printf") is correct, as is the POSIX specification. Quoting the info
> manual:
>
> • An additional directive ‘%b’, prints its argument string with ‘\’
> escapes interpreted in the same way as in the FORMAT string,
> except that octal escapes are of the form ‘\0OOO’ where OOO is 0
> to 3 octal digits. If ‘\OOO’ is nine-bit value, ignore the
> ninth bit. If a precision is also given, it limits the number of bytes
> printed from the converted string.
>
> So for example, the man page implies that
> printf "%b" "\01x"
> prints a null character, the digit '1', and the letter 'x'. In fact it
> prints character 1 (Ctrl-A) and the letter 'x'.

I can't find the null character:

$ printf "%b" "\01x" | od -v -A n -t o1
001 170

HY

> --
> Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
> Working, but not speaking, for Philips Healthcare
> void Void(void) { Void(); } /* The recursive call of the void */

Re: Restore the destroyed disk image partition table by dd.

<83k0ovfb0i.fsf@helmutwaitzmann.news.arcor.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3709&group=comp.unix.shell#3709

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!tNUTLOPypmZ99vEO5vHUQQ.user.gioia.aioe.org.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Thu, 22 Apr 2021 01:55:41 +0200
Organization: Aioe.org NNTP Server
Lines: 24
Message-ID: <83k0ovfb0i.fsf@helmutwaitzmann.news.arcor.de>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de>
<f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de>
<1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de>
<db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de>
<74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<878s5bv563.fsf@bsb.me.uk> <87zgxrb9v4.fsf@nosuchdomain.example.com>
<bbd67f4e-6ded-4639-a6ee-fa29038f78e1n@googlegroups.com>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
NNTP-Posting-Host: tNUTLOPypmZ99vEO5vHUQQ.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock: sha1:dELxUGeIoodKdD8oTfrnUz1ja1U=
Mail-Copies-To: nobody
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
X-Notice: Filtered by postfilter v. 0.9.2
 by: Helmut Waitzmann - Wed, 21 Apr 2021 23:55 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com>:
>On Thursday, April 22, 2021 at 5:34:11 AM UTC+8, Keith Thompson wrote:

>> So for example, the man page implies that
>>
>> printf "%b" "\01x"
>> prints a null character, the digit '1', and the letter 'x'. In
>> fact it prints character 1 (Ctrl-A) and the letter 'x'.
>
>I can't find the null character:
>
>
>$ printf "%b" "\01x" | od -v -A n -t o1
> 001 170
>

Yes.  In fact it does what Keith wrote.  If one uses the '\0NNN'
form (and single rather than double quotes)

printf '%b' '\00001x' | od -v -A n -t o1

then there is no ambiguity. 

Re: Restore the destroyed disk image partition table by dd.

<87v98fb1kg.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3710&group=comp.unix.shell#3710

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Wed, 21 Apr 2021 17:33:19 -0700
Organization: None to speak of
Lines: 23
Message-ID: <87v98fb1kg.fsf@nosuchdomain.example.com>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de>
<f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de>
<1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de>
<db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de>
<74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de>
<dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<878s5bv563.fsf@bsb.me.uk> <87zgxrb9v4.fsf@nosuchdomain.example.com>
<bbd67f4e-6ded-4639-a6ee-fa29038f78e1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f5e8f3a76393286ae2053b34f5302b62";
logging-data="30696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ESI24F5vo9MJWBIPdXDic"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Cancel-Lock: sha1:L5bobghUepc4j1KAOS0wHTSCSyM=
sha1:hHU1cvykIbRxZDWM9okryptixTg=
 by: Keith Thompson - Thu, 22 Apr 2021 00:33 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:
> On Thursday, April 22, 2021 at 5:34:11 AM UTC+8, Keith Thompson wrote:
[...]
>> So for example, the man page implies that
>> printf "%b" "\01x"
>> prints a null character, the digit '1', and the letter 'x'. In fact it
>> prints character 1 (Ctrl-A) and the letter 'x'.
>
> I can't find the null character:
>
> $ printf "%b" "\01x" | od -v -A n -t o1
> 001 170

No, of course not. Why would you expect a null character?

The description in the man page implies that it would print a null
character. That description is incorrect; it doesn't match the info
manual, the POSIX specification, or the actual behavior.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Re: Restore the destroyed disk image partition table by dd.

<ba8c9eb9-aa94-47a1-9f37-dbd12ab34744n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3711&group=comp.unix.shell#3711

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ae9:e119:: with SMTP id g25mr1247340qkm.42.1619055960473;
Wed, 21 Apr 2021 18:46:00 -0700 (PDT)
X-Received: by 2002:ae9:c014:: with SMTP id u20mr1178005qkk.55.1619055960243;
Wed, 21 Apr 2021 18:46:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Wed, 21 Apr 2021 18:45:59 -0700 (PDT)
In-Reply-To: <83k0ovfb0i.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=172.104.104.201; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.104.104.201
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com>
<83sg3vs5oi.fsf@helmutwaitzmann.news.arcor.de> <f8b3f87c-677f-46d2-9ecb-44e3ac402c01n@googlegroups.com>
<83lf9mq9cl.fsf@helmutwaitzmann.news.arcor.de> <1bfe4530-5697-4e8d-a98a-2898971161a0n@googlegroups.com>
<83a6q0pl53.fsf@helmutwaitzmann.news.arcor.de> <db872422-dc2c-41ef-a1c0-d640020fb8ebn@googlegroups.com>
<8335volp7x.fsf@helmutwaitzmann.news.arcor.de> <74fdb5af-f20b-427c-b1d8-82b6f4e5ccb0n@googlegroups.com>
<83eef8jjr1.fsf@helmutwaitzmann.news.arcor.de> <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com>
<878s5bv563.fsf@bsb.me.uk> <87zgxrb9v4.fsf@nosuchdomain.example.com>
<bbd67f4e-6ded-4639-a6ee-fa29038f78e1n@googlegroups.com> <83k0ovfb0i.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ba8c9eb9-aa94-47a1-9f37-dbd12ab34744n@googlegroups.com>
Subject: Re: Restore the destroyed disk image partition table by dd.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 22 Apr 2021 01:46:00 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Thu, 22 Apr 2021 01:45 UTC

On Thursday, April 22, 2021 at 7:58:31 AM UTC+8, Helmut Waitzmann wrote:
> "hongy...@gmail.com" <hongy...@gmail.com>:
> >On Thursday, April 22, 2021 at 5:34:11 AM UTC+8, Keith Thompson wrote:
>
> >> So for example, the man page implies that
> >>
> >> printf "%b" "\01x"
> >> prints a null character, the digit '1', and the letter 'x'. In
> >> fact it prints character 1 (Ctrl-A) and the letter 'x'.
> >
> >I can't find the null character:
> >
> >
> >$ printf "%b" "\01x" | od -v -A n -t o1
> > 001 170
> >
> Yes. In fact it does what Keith wrote. If one uses the '\0NNN'
> form (and single rather than double quotes)
>
> printf '%b' '\00001x' | od -v -A n -t o1
>
> then there is no ambiguity.

Yep. See below:

$ printf '%b' '\00001x' | od -v -A n -t o1
000 061 170

Re: Restore the destroyed disk image partition table by dd.

<s5r5hq$m4c$1@news.dns-netz.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3712&group=comp.unix.shell#3712

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!news.dns-netz.com!news.freedyn.net!.POSTED!not-for-mail
From: joe...@schily.net
Newsgroups: comp.unix.shell
Subject: Re: Restore the destroyed disk image partition table by dd.
Date: Thu, 22 Apr 2021 06:36:42 -0000 (UTC)
Message-ID: <s5r5hq$m4c$1@news.dns-netz.com>
References: <ff939643-60ba-4044-b8b1-9cb2b247d4ecn@googlegroups.com> <dc4a4cf6-c6b4-4409-92c8-9fdc162df35bn@googlegroups.com> <s5q1eg$pqa$1@news.dns-netz.com> <83sg3jff6g.fsf@helmutwaitzmann.news.arcor.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: eJxdjUEKwjAQRdd6iiErBRPrKEFaAhWvUA8Q0pBG0kloUkRPb9z61u/9T/aVxUiZky0fYeLcQYq5eHJcGxNXKoo9o11cn83kw1tUj3XbTYjO/aRRF60YopRX1sGsfeB1JAXtqWReomJrtrXp6f+IwRGGaT0AItzSAtjgCRrZnmV7QeBNBXaP4b7/Ajq+NGM=
Cancel-Lock: sha1:4Hsitw99o+RkniMrkATiA8EMG8U=
X-Abuse-Contact: "abuse@dns-netz.com"
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
 by: joe...@schily.net - Thu, 22 Apr 2021 06:36 UTC

In article <83sg3jff6g.fsf@helmutwaitzmann.news.arcor.de>,
Helmut Waitzmann <oe.throttle@xoxy.net> wrote:
>joerg@schily.net:
>
>>But be careful,
>>
>> printf '%b\n' 'ab\0cd'
>>
>>is not supported corectly by all printf(1) implementations.
>>
>>In special dash(1) is affected.
>
>… in some legacy version of Debian: 

There are some long term support Linux distros that did not update
the dash to a working one...

--
EMail:joerg@schily.net Jörg Schilling D-13353 Berlin
Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor