Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leer: fix jet mismatch #480

Closed
wants to merge 1 commit into from
Closed

leer: fix jet mismatch #480

wants to merge 1 commit into from

Conversation

pkova
Copy link
Collaborator

@pkova pkova commented Jun 30, 2023

With old jet:

> `(list @tas)`(to-wain:format 'hello\0a\0a')
~[%hello %$]

>`(list @tas)`(to-wain:format 'hello\0a')
~[%hello]

Without old jet:

> `(list @tas)`(to-wain:format 'hello\0a\0a')
~[%hello %$ %$]

>`(list @tas)`(to-wain:format 'hello\0a')
~[%hello %$]

The unjetted behavior certainly seems more reasonable to me so this PR fixes the jet to match the hoon. Here's a generator to test stuff out with:

=>
|%
  ++  to-wain                                           ::  cord to line list
    ::  ~%  %leer  ..part  ~
    |=  txt=cord
    ^-  wain
    =/  len=@  (met 3 txt)
    =/  cut  =+(cut -(a 3, c 1, d txt))
    =/  sub  sub
    =|  [i=@ out=wain]
    |-  ^+  out
    =+  |-  ^-  j=@
        ?:  ?|  =(i len)
                =(10 (cut(b i)))
            ==
          i
        $(i +(i))
    =.  out  :_  out
      (cut(b i, c (sub j i)))
    ~&  `(list @tas)`out
    ?:  =(j len)
      (flop out)
    $(i +(j))
--
:-  %say
|=  [^ [arg=@t ~] ~]
:-  %noun
(to-wain arg)

@pkova pkova requested a review from a team as a code owner June 30, 2023 13:05
Copy link
Contributor

@ashelkovnykov ashelkovnykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me

@joemfb
Copy link
Member

joemfb commented Jun 30, 2023

Releasing this is blocked on #459. There's also a failure in the fake-ship tests, not sure what the issue is.

@joemfb
Copy link
Member

joemfb commented Jun 30, 2023

There's a second mismatch here:

> `*`=+(to-wain:format .*(-(+6 '') -<))
[0 0]
> `*`(to-wain:format '')
0

@pkova
Copy link
Collaborator Author

pkova commented Jul 5, 2023

After discussion with @joemfb we decided on the following.

Two reasonable ways of handling unix file -> (list @t) conversions are:

  1. Be strict with requiring that the files end in newlines. This is what lune:unix:userlib already does.
  2. Be loose and silently normalize, losing invertibility but allowing people to |commit files that have been generated with arbitrarily broken tools.

Strategy number 2 is currently in use. We should probably use strategy 1 for at least some marks, but that involves changing the marks and possibly lune:unix:userlib, not to-wain/%leer.

I made urbit/urbit#6707 to fix the jet mismatch that Joe found, closing this PR for the reasons above.

@pkova pkova closed this Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants