Dyalog / link

Source code for Link – the built-in component that enables the use of text files as the primary storage mechanism for APL source code
https://dyalog.github.io/link
MIT License
19 stars 12 forks source link

Watch=ns, creating a function with spaces and saving the link in a workspace does not work #502

Open dyavc opened 1 year ago

dyavc commented 1 year ago

Describe the bug If you create a link with -watch=ns ,create a function with spaces in it, and saving the link in a workspace, you cannot use the link on re-loading that workspace. ]link.resync and ]link.break both do not work

To Reproduce ⍝ Create a namespace Test
)ns #.test

⍝  Link it to new directory     

]Link.Create #.test d:/temp/linkd1 -watch=ns

⍝ Edit a new function , inside we write A← A / B (with spaces between)

)ed #.test.testfn ⎕CR '#.test.testfn'
testfn
A←A/B ⍝ We can see, the editor removed the spaces

⎕NGET'd:\temp\linkd1\testfn.aplf' ⍝ but on file, they still exist, ⍝ this is the first problem (Link first stores, and the after it, fix removes the spaces … )save d:\temp\d1test.dws
d:\temp\d1test.dws saved Thu Nov 24 15:24:50 2022
⍝.. And reload it, of course, Link reports some problems )off )load d:\temp\d1test.dws Link Warning: IMPORTANT: 1 namespaces linked in this workspace: #.test Link Warning: IMPORTANT: Link.Resync is required
]Link.Resync ok.. We do resync.,,
1 update required
NOTE: 1 changes must be resolved by hand before -proceed is possible ⍝ Not possible, because number of spaces inside function in workspace and on disk differs. ⍝ Also, even if modify by hand the one on disk to be the same, still get the same complaint

]link.resync -proceed ERRORS ENCOUNTERED: ⎕SE.Link.Resync: Manual resolution required: ? #.test.testfn d:/temp/linkd1/testfn.aplf Sources differ

⍝ Also, link.break does not work either ]link.break ERRORS ENCOUNTERED: Link.Resync is required

Expected behaviour Either the break or the resync to succeed.

Desktop (please complete the following information): Dyalog 18.2.46299 64-bit Unicode, BuildID 03d73742
OS Windows 10 or Windows Server 2016 (10.0.19045) 64-bit
Link 3.1.2
SALT 2.9
UCMD 2.51

This was reported by a Dyalog customer based in Germany.

dyavc commented 1 year ago

I think the link and the workspace will work as expected, but only if you create the link after the function is created.

If I add spaces to the file on disk, I do get a resync required message upon loading my other test workspace. But, this can be resolved by removing the spaces in the file on disc. The resync works.