'guix style' pretty-printer always renders integers as base10

  • Done
  • quality assurance status badge
Details
5 participants
  • Ludovic Courtès
  • Maxime Devos
  • (
  • Csepp
  • Christopher Rodriguez
Owner
unassigned
Submitted by
Christopher Rodriguez
Severity
normal
C
C
Christopher Rodriguez wrote on 9 Aug 2022 22:47
[BUG] Default Notation for chmod in guix style?
(address . bug-guix@gnu.org)
878rnxi1it.fsf@gmail.com
Hello,

I've noticed that, when I explicitly declare absolute permissions in
octal during a (chmod …) in my package definitions and then run guix
style, it converts them to decimal instead.

Is this intended? I've gotten feedback and agree that octal (#o755) is
much clearer to read than decimal (493), simply because I'm used to the
actual unix chmod tool and its conventions.

--

Christopher Rodriguez
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJMQbvYVxvZ0eF/84XZ6FgaGVz3sFAmLyyMoACgkQXZ6FgaGV
z3umXA//b1FpJ7Kn6E58QWOFCr0sp0Dh0glJBiMWlAzuzmY+Z9dwK6tAi+K7ffNn
WEm5+qV6lGOdwXJfNjgxlBSgnqSDz6TPCubhMXX4HBLrlWRG2Ql8An0n/kC/bjEV
Tyh/JG5gPZHDMrVlaarrWQeFu1/dhmRDSMkLafez3u3LaO0sfH+rSm/10QFugdLa
ClFIr0x+X+ZkCRGkrbQyV/y+A7cypnS3EwzGrr7Cf8GoolgII2R29gUADRGkGxDO
gAGPOuJg1CXWC/0Jb14N0Koq5FbSnn7K7QUXlh0pPzCmv1UaIEYgrJcfvMgdzc8R
SAS3QoDucQHP9yNa5KpMT6z89cpZjXNQ+GaDOxsEz+EpvzcTHpUZ4XkhkuGNO2C0
D1DWoXCl4AliLn4j7N7xkJqsdRpm08s+AbFW5/xf47DX+ItjAfrRn8YPGDKCkJz9
yeNctvFQd4oA81Na4O1sLcZzUSpAvKKnQg399/kXPU7quY/aQP6w8Zjd98XKk5h8
i1+JfacLN1gSd4fOz764uiQ1Hfiw3cHKfwPUMBQqgRxwazyr6lzLiDVbKVE6Nbvg
nZLd04m1oZH9iiMoYluEX+cedapPXfCC6cscAnU+nTvS7aWhroCq8tcc0jaTJM2l
jfY24oZxW5Nekqbgd3iBBEKahOyy8xbssH8q1sCjaTKP71fWxRw=
=LYUE
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 9 Aug 2022 22:59
3f031a26-5835-e4ac-d8e5-ed725d8b1633@telenet.be
Note: No need for [BUG] prefixes -- they are prefixed automatically by
bug#NNNNN and the bug tracker is either for bugs or patches, and the
latter has the [PATCH ...] convention. No harm though.
On 09-08-2022 22:47, Christopher Rodriguez wrote:
Toggle quote (13 lines)
> Hello,
>
> I've noticed that, when I explicitly declare absolute permissions in
> octal during a (chmod …) in my package definitions and then run guix
> style, it converts them to decimal instead.
>
> Is this intended? I've gotten feedback and agree that octal (#o755) is
> much clearer to read than decimal (493), simply because I'm used to the
> actual unix chmod tool and its conventions.
>
> --
>
> Christopher Rodriguez
'chmod' is not mentioned anywhere in (guix scripts style), so I'd think
it's just an oversight. The authority on the matter would be Ludovic
Courtès <ludo@gnu.org>
Disclaimer: I'm the one that wrote that feedback. Let's not double-count
my non-existent 'votes'.
Greetings,
Maxime
Attachment: OpenPGP_signature
C
C
Csepp wrote on 9 Aug 2022 23:01
(name . Christopher Rodriguez)(address . yewscion@gmail.com)
87wnbhf7sd.fsf@riseup.net
Christopher Rodriguez <yewscion@gmail.com> writes:

Toggle quote (12 lines)
> [[PGP Signed Part:Undecided]]
>
> Hello,
>
> I've noticed that, when I explicitly declare absolute permissions in
> octal during a (chmod …) in my package definitions and then run guix
> style, it converts them to decimal instead.
>
> Is this intended? I've gotten feedback and agree that octal (#o755) is
> much clearer to read than decimal (493), simply because I'm used to the
> actual unix chmod tool and its conventions.

Seems to be a Scheme limitation:

```
scheme@(guile-user)> '(#o10)
$1 = (8)
```
(
CM1SWY80OFEA.YWFI9JJ7KLOC@guix-aspire
On Tue Aug 9, 2022 at 9:59 PM BST, Maxime Devos wrote:
Toggle quote (4 lines)
> 'chmod' is not mentioned anywhere in (guix scripts style), so I'd think
> it's just an oversight. The authority on the matter would be Ludovic
> Courtès <ludo@gnu.org>

Is it possible that (guix read-print) stores octal numbers directly as
Scheme numbers, with no way to distinguish them from decimal numbers,
which means when they are printed they are just treated as base10? I
poked around a bit in the module but couldn't find the code for number
reading.

-- (
(
(address . 57090@debbugs.gnu.org)
CM1T0DEFGBLX.1AX6V2L09HFML@guix-aspire
On Tue Aug 9, 2022 at 10:01 PM BST, Csepp wrote:
Toggle quote (7 lines)
> Seems to be a Scheme limitation:
>
> ```
> scheme@(guile-user)> '(#o10)
> $1 = (8)
> ```

`guix style` uses a completely seperate reader, defined
in (guix read-print), so even though it's possible it has
the same limitation, we could easily modify it to support
octal/hexadecimal/binary numbers.

-- (
L
L
Ludovic Courtès wrote on 9 Aug 2022 23:12
(name . ()(address . paren@disroot.org)
87czd92kaz.fsf@gnu.org
Hi,

"(" <paren@disroot.org> skribis:

Toggle quote (11 lines)
> On Tue Aug 9, 2022 at 9:59 PM BST, Maxime Devos wrote:
>> 'chmod' is not mentioned anywhere in (guix scripts style), so I'd think
>> it's just an oversight. The authority on the matter would be Ludovic
>> Courtès <ludo@gnu.org>
>
> Is it possible that (guix read-print) stores octal numbers directly as
> Scheme numbers, with no way to distinguish them from decimal numbers,
> which means when they are printed they are just treated as base10? I
> poked around a bit in the module but couldn't find the code for number
> reading.

Indeed, the reader is basically a wrapper around ‘read’. It preserves
comments and vertical space, but it doesn’t attempt to preserve the
style of numbers (base, etc.), strings (whether \n & co. are escaped or
literal), and so on. I think that’d be a bit too much honestly.

Now, we could tweak the pretty printer so that it recognizes patterns
where numbers or strings should be printed in a certain way.

Help welcome! :-)

Ludo’.
L
L
Ludovic Courtès wrote on 31 Aug 2022 11:20
control message for bug #57090
(address . control@debbugs.gnu.org)
87zgfkdb16.fsf@gnu.org
retitle 57090 'guix style' pretty-printer always renders integers as base10
quit
L
L
Ludovic Courtès wrote on 1 Sep 2022 18:43
Re: bug#57090: 'guix style' pretty-printer always renders integers as base10
(name . ()(address . paren@disroot.org)
87k06nyrit.fsf_-_@gnu.org
Hi,

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (3 lines)
> Now, we could tweak the pretty printer so that it recognizes patterns
> where numbers or strings should be printed in a certain way.

I did that in c3b1cfe76b7038f4030d7d207ffc417fed9a7ead. Lemme know how
you like it! :-)

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 57090@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57090
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch