[Tcsh] backslashed escape sequences in echo
Michal Szymanski
msz at astrouw.edu.pl
Tue Jul 2 11:51:46 UTC 2024
Hi, thanks for the explanation.
I think we do have here sort of "historical mess". The original SysV
echo(1) syntax suggesting \0ccc as an octal-coded character is quite
strange as it seems to be an jumble of the well-known C syntax for an
octal integer constant (0ccc) *and* an octal-escape-sequence (\ccc).
The latter has never required zero as the first digit. Surely a '0' is
an octal digit but the C syntax for octal escape sequence allows only
1 to 3 digits, so \0140 is not a valid C octal escape sequence.
Indeed, printf("\0140 \n") outputs a formfeed (reduced to a newline
in my terminal) followed by '0' and the final newline. Pretty much like the
new version of tcsh.
regards, Michal.
On Tue, Jul 02, 2024 at 01:12:20PM +0200, H.Merijn Brand wrote:
> On Tue, 2 Jul 2024 11:52:29 +0200, Michal Szymanski <msz at astrouw.edu.pl> wrote:
>
> > Hi,
> >
> > I've just noticed a changed behavior of 'echo' command with octal
> > \xxxx sequence. Most of the machines run Rocky Linux 8.10 with tcsh
> > 6.20.00. One of my aliases includes command (simplified here)
> > echo "a \0140 b"
> > which has been working for years giving
> > a ` b
> >
> > Now on my Ubuntu desktop recently upgraded to 24.04, coming (what a
> > coincidence :) with tcsh 6.24.10, this has broke and the output is now
> > a
> > 0 b
>
> That change happened between 6.23.00 and 6.23.01
> 38 commits (merge commits excluded)
>
> I just verified that e6c9f58b10797e1b793c70782aad239f7087a037 (my work
> to improve Unicode support) is the cause.
>
> https://github.com/tcsh-org/tcsh/commit/06915a414e185d314d5117b04ee460e441cbe962
>
> > To get the previous behavior, I have to remove the 0, echo "a \140 b"
> >
> > It works as such even if I change $echo_style from the default "both"
> > to "sysv" when it should, AFAIU, mimic the SYSV behavior of echo(1).
> > This is not true as the echo(1) requires 0 before 1 to 3 octal digits,
> > at least in the manual:
> >
> > \0NNN byte with octal value NNN (1 to 3 digits)
> >
> > In the real world, however, both versions give the octal-coded char:
> >
> > >/usr/bin/echo -e "a \140 b"
> > a ` b
> > >/usr/bin/echo -e "a \0140 b"
> > a ` b
> >
> > Is that to be expected? When was it introduced? I cannot find any
> > "Changelog" file in tcsh sources. There is "Fixes" file, and "BUGS"
> > file, but no Changelog. The most recent mention of 'octal' in "Fixes"
> > is from May 12, 2010 and refers to V6.17.02.
> >
> > best, Michal
> >
>
>
> --
> H.Merijn Brand https://tux.nl Perl Monger http://amsterdam.pm.org/
> using perl5.00307 .. 5.37 porting perl5 on HP-UX, AIX, and Linux
> https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
>
> --
> Tcsh mailing list
> Tcsh at astron.com
> https://mailman.astron.com/mailman/listinfo/tcsh
--
Michal Szymanski (msz at astrouw dot edu dot pl)
Warsaw University Observatory, Warszawa, POLAND
More information about the Tcsh
mailing list