bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GAWK on Termux behaves differently when invoked as either AWK or GAW


From: arnold
Subject: Re: GAWK on Termux behaves differently when invoked as either AWK or GAWK.
Date: Tue, 05 Jan 2021 06:46:50 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

I'm not familiar with Termux.  There should be no difference between
invocation of gawk as 'awk' or as something else, since gawk pays no
attention to argv[0].  (Unless the Termux guys modified the code.)

That said, it does look like a locale issue, since env -i clears the 
environment,
forcing gawk to use the "C" locale.

You can use

        LC_ALL=C gawk ...

as one way to get what you want. Another choice is to use gawk's -b
option, which forces gawk to treat characters as bytes.

Thanks,

Arnold

"K. Kurokawa" <nine-k.960klo@yandex.com> wrote:

>    I am trying to let GAWK output every byte in range of 1--255, but I
>    think I have found a bug.
>
>    To summarize, I have found it works when I invoke AWK, symbolic link to
>    GAWK, under env -i,
>
>    and it's the only way I have ever found. I have never found the way
>    when invoked as GAWK yet.
>
>    <a
>    href="https://github.com/termux/termux-packages/issues/5845";>Question
>    and response if Termux has C locale.</a>
>
>    <termux>
>
>    $ termux-info
>
>    Packages CPU architecture:
>
>    aarch64
>
>    Subscribed repositories:
>
>    # sources.list                                          deb
>    https://main.termux-mirror.ml/ stable main
>
>    # science-repo (sources.list.d/science.list)            deb
>    https://dl.bintray.com/grimler/science-packages-24 science stable
>
>    # game-repo (sources.list.d/game.list)
>
>    deb https://dl.bintray.com/grimler/game-packages-24 games stable
>                                            Updatable packages:
>
>    All packages up to date
>
>    Android version:
>
>    10
>
>    Kernel build information:
>
>    Linux localhost 4.4.177-19944695 #1 SMP PREEMPT Wed Oct 14 17:33:31 KST
>    2020 aarch64 Android                    Device manufacturer:
>
>    samsung                                                 Device model:
>
>    SCV43
>
>    </termux>
>
>    <version>
>
>    $ awk --version
>    GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
>    Copyright (C) 1989, 1991-2020 Free Software Foundation.
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
>    the Free Software Foundation; either version 3 of the License, or
>    (at your option) any later version.
>    This program is distributed in the hope that it will be useful,
>    but WITHOUT ANY WARRANTY; without even the implied warranty of
>                                            MERCHANTABILITY or FITNESS FOR
>    A PARTICULAR PURPOSE.  See the
>    GNU General Public License for more details.
>    You should have received a copy of the GNU General Public License
>    along with this program. If not, see http://www.gnu.org/licenses/.
>    $ gawk --version
>    GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
>    Copyright (C) 1989, 1991-2020 Free Software Foundation.
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
>    the Free Software Foundation; either version 3 of the License, or
>                                             (at your option) any later
>    version.
>                                                            This program is
>    distributed in the hope that it will be useful,
>    but WITHOUT ANY WARRANTY; without even the implied warranty of
>    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>    GNU General Public License for more details.
>    You should have received a copy of the GNU General Public License
>    along with this program. If not, see http://www.gnu.org/licenses/.
>
>    </version>
>
>    <which>
>
>    $ which awk gawk | xargs ls
>    /data/data/com.termux/files/usr/bin/awk
>    /data/data/com.termux/files/usr/bin/gawk
>    $ which awk gawk | xargs ls -l
>    lrwxrwxrwx 1 u0_a284 u0_a284     18 Sep 20 17:56
>    /data/data/com.termux/files/usr/bin/awk -> gawk
>    -rwx------ 1 u0_a284 u0_a284 465056 Sep 20 17:56
>    /data/data/com.termux/files/usr/bin/gawk
>
>    </which>
>
>    <actual_behaves>
>
>    $ awk  'BEGIN{for(i=1;i<=255;i++)printf("%c",i)}' | od -A n -t x1 -v
>     01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
>     11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20
>     21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
>     31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40
>     41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50
>     51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60
>     61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70
>     71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f c2
>     80 c2 81 c2 82 c2 83 c2 84 c2 85 c2 86 c2 87 c2
>     88 c2 89 c2 8a c2 8b c2 8c c2 8d c2 8e c2 8f c2
>     90 c2 91 c2 92 c2 93 c2 94 c2 95 c2 96 c2 97 c2
>     98 c2 99 c2 9a c2 9b c2 9c c2 9d c2 9e c2 9f c2
>     a0 c2 a1 c2 a2 c2 a3 c2 a4 c2 a5 c2 a6 c2 a7 c2
>     a8 c2 a9 c2 aa c2 ab c2 ac c2 ad c2 ae c2 af c2
>     b0 c2 b1 c2 b2 c2 b3 c2 b4 c2 b5 c2 b6 c2 b7 c2
>     b8 c2 b9 c2 ba c2 bb c2 bc c2 bd c2 be c2 bf c3
>     80 c3 81 c3 82 c3 83 c3 84 c3 85 c3 86 c3 87 c3         88 c3 89 c3 8a
>    c3 8b c3 8c c3 8d c3 8e c3 8f c3
>     90 c3 91 c3 92 c3 93 c3 94 c3 95 c3 96 c3 97 c3
>     98 c3 99 c3 9a c3 9b c3 9c c3 9d c3 9e c3 9f c3
>     a0 c3 a1 c3 a2 c3 a3 c3 a4 c3 a5 c3 a6 c3 a7 c3
>     a8 c3 a9 c3 aa c3 ab c3 ac c3 ad c3 ae c3 af c3
>     b0 c3 b1 c3 b2 c3 b3 c3 b4 c3 b5 c3 b6 c3 b7 c3
>     b8 c3 b9 c3 ba c3 bb c3 bc c3 bd c3 be c3 bf
>    $ env -i awk  'BEGIN{for(i=1;i<=255;i++)printf("%c",i)}' | od -A n -t
>    x1 -v
>     01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
>     11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20
>     21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
>     31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40
>     41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50
>     51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60
>     61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70
>     71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80
>     81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90
>     91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0
>     a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0
>     b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0
>     c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0
>     d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0
>     e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0
>     f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
>    $  gawk  'BEGIN{for(i=1;i<=255;i++)printf("%c",i)}' | od -A n -t x1 -v
>     01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
>     11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20
>     21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30         31 32 33 34 35
>    36 37 38 39 3a 3b 3c 3d 3e 3f 40
>     41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50         51 52 53 54 55
>    56 57 58 59 5a 5b 5c 5d 5e 5f 60
>     61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70         71 72 73 74 75
>    76 77 78 79 7a 7b 7c 7d 7e 7f c2
>     80 c2 81 c2 82 c2 83 c2 84 c2 85 c2 86 c2 87 c2
>     88 c2 89 c2 8a c2 8b c2 8c c2 8d c2 8e c2 8f c2
>     90 c2 91 c2 92 c2 93 c2 94 c2 95 c2 96 c2 97 c2         98 c2 99 c2 9a
>    c2 9b c2 9c c2 9d c2 9e c2 9f c2
>     a0 c2 a1 c2 a2 c2 a3 c2 a4 c2 a5 c2 a6 c2 a7 c2         a8 c2 a9 c2 aa
>    c2 ab c2 ac c2 ad c2 ae c2 af c2
>     b0 c2 b1 c2 b2 c2 b3 c2 b4 c2 b5 c2 b6 c2 b7 c2         b8 c2 b9 c2 ba
>    c2 bb c2 bc c2 bd c2 be c2 bf c3
>     80 c3 81 c3 82 c3 83 c3 84 c3 85 c3 86 c3 87 c3
>     88 c3 89 c3 8a c3 8b c3 8c c3 8d c3 8e c3 8f c3
>     90 c3 91 c3 92 c3 93 c3 94 c3 95 c3 96 c3 97 c3         98 c3 99 c3 9a
>    c3 9b c3 9c c3 9d c3 9e c3 9f c3
>     a0 c3 a1 c3 a2 c3 a3 c3 a4 c3 a5 c3 a6 c3 a7 c3         a8 c3 a9 c3 aa
>    c3 ab c3 ac c3 ad c3 ae c3 af c3
>     b0 c3 b1 c3 b2 c3 b3 c3 b4 c3 b5 c3 b6 c3 b7 c3         b8 c3 b9 c3 ba
>    c3 bb c3 bc c3 bd c3 be c3 bf
>    $ env -i gawk  'BEGIN{for(i=1;i<=255;i++)printf("%c",i)}' | od -A n -t
>    x1 -v
>     01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
>     11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20
>     21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
>     31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40
>     41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50
>     51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60
>     61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70
>     71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f c2
>     80 c2 81 c2 82 c2 83 c2 84 c2 85 c2 86 c2 87 c2
>     88 c2 89 c2 8a c2 8b c2 8c c2 8d c2 8e c2 8f c2
>     90 c2 91 c2 92 c2 93 c2 94 c2 95 c2 96 c2 97 c2
>     98 c2 99 c2 9a c2 9b c2 9c c2 9d c2 9e c2 9f c2
>     a0 c2 a1 c2 a2 c2 a3 c2 a4 c2 a5 c2 a6 c2 a7 c2
>     a8 c2 a9 c2 aa c2 ab c2 ac c2 ad c2 ae c2 af c2
>     b0 c2 b1 c2 b2 c2 b3 c2 b4 c2 b5 c2 b6 c2 b7 c2
>     b8 c2 b9 c2 ba c2 bb c2 bc c2 bd c2 be c2 bf c3
>     80 c3 81 c3 82 c3 83 c3 84 c3 85 c3 86 c3 87 c3
>     88 c3 89 c3 8a c3 8b c3 8c c3 8d c3 8e c3 8f c3
>     90 c3 91 c3 92 c3 93 c3 94 c3 95 c3 96 c3 97 c3
>     98 c3 99 c3 9a c3 9b c3 9c c3 9d c3 9e c3 9f c3
>     a0 c3 a1 c3 a2 c3 a3 c3 a4 c3 a5 c3 a6 c3 a7 c3
>     a8 c3 a9 c3 aa c3 ab c3 ac c3 ad c3 ae c3 af c3
>     b0 c3 b1 c3 b2 c3 b3 c3 b4 c3 b5 c3 b6 c3 b7 c3
>     b8 c3 b9 c3 ba c3 bb c3 bc c3 bd c3 be c3 bf
>
>    $ env -i gawk -v BINMODE=2  'BEGIN{for(i=1;i<=255;i++)printf("%c",i)}'
>    | od -A n -t x1 -v
>
>     01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
>
>     11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20
>
>     21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
>
>     31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40
>
>     41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50
>
>     51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60
>
>     61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70
>
>     71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f c2
>
>     80 c2 81 c2 82 c2 83 c2 84 c2 85 c2 86 c2 87 c2
>
>     88 c2 89 c2 8a c2 8b c2 8c c2 8d c2 8e c2 8f c2
>
>     90 c2 91 c2 92 c2 93 c2 94 c2 95 c2 96 c2 97 c2
>
>     98 c2 99 c2 9a c2 9b c2 9c c2 9d c2 9e c2 9f c2
>
>     a0 c2 a1 c2 a2 c2 a3 c2 a4 c2 a5 c2 a6 c2 a7 c2
>
>     a8 c2 a9 c2 aa c2 ab c2 ac c2 ad c2 ae c2 af c2
>
>     b0 c2 b1 c2 b2 c2 b3 c2 b4 c2 b5 c2 b6 c2 b7 c2
>
>     b8 c2 b9 c2 ba c2 bb c2 bc c2 bd c2 be c2 bf c3
>
>     80 c3 81 c3 82 c3 83 c3 84 c3 85 c3 86 c3 87 c3
>
>     88 c3 89 c3 8a c3 8b c3 8c c3 8d c3 8e c3 8f c3
>
>     90 c3 91 c3 92 c3 93 c3 94 c3 95 c3 96 c3 97 c3
>
>     98 c3 99 c3 9a c3 9b c3 9c c3 9d c3 9e c3 9f c3
>
>     a0 c3 a1 c3 a2 c3 a3 c3 a4 c3 a5 c3 a6 c3 a7 c3
>
>     a8 c3 a9 c3 aa c3 ab c3 ac c3 ad c3 ae c3 af c3
>
>     b0 c3 b1 c3 b2 c3 b3 c3 b4 c3 b5 c3 b6 c3 b7 c3
>
>     b8 c3 b9 c3 ba c3 bb c3 bc c3 bd c3 be c3 bf
>
>    </actual_behaves>
>
>    --
>    Sent from Yandex.Mail for mobile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]