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

Windows carriage return pollution #215

Open
ngeiswei opened this issue Dec 10, 2024 · 4 comments
Open

Windows carriage return pollution #215

ngeiswei opened this issue Dec 10, 2024 · 4 comments
Labels
bug Issues that represent errors in the code

Comments

@ngeiswei
Copy link
Contributor

Windows carriage return characters (^M in Unix) sometimes find their way in the code. The latest targeted file for me was scripts/envvars_mettalog.sh which crashed the installation of MeTTaLog with error

'\r': command not found

It's a not a big deal, I just apply dos2unix on the file to fix the problem, but I thought I would mention it nonetheless.

Also, I tried to create a PR with the fixed file but weirdly enough git does not seem to register the change.

@ngeiswei ngeiswei added the bug Issues that represent errors in the code label Dec 10, 2024
@ngeiswei
Copy link
Contributor Author

Another spooky oddity, from a Unix system, the following

for i in {1..1981}; do echo ""; done > newlines.metta
unix2dos newlines.metta
mettalog newlines.metta

triggers a never ending stream of errors, such as

% 23,906 inferences, 0.004 CPU in 0.004 seconds (100% CPU, 6692086 Lips)
; Done translating 0 forms: asserted_metta_pred(song_newlines_1733834775_5416088,'/home/nilg/Work/SingularityNET/ai-dsl/experimental/ai-service-composition/english-to-chinese-song/newlines.metta').

#(failed #( : user once ) #( : user fail ))


#(on_mettalog_error #(failed #( : user once ) #( : user fail )))

^  Call: (167) [user] call(user:once, user:fail)
^  Call: (168) [user] once(user:fail)
   Call: (169) [system] fail
^  Fail: (167) [system] call(user:once, user:fail)
^  Call: (167) [bugger] bugger:mquietly_if(true, rtrace:pop_tracer)
   Call: (169) [system] var(rtrace:pop_tracer)
   Fail: (169) [system] var(rtrace:pop_tracer)
^  Call: (171) [system] setup_call_cleanup('$notrace'(_36330, _36332), once(rtrace:retract(t_l:tracer_reset(_36320))), '$restore_trace'(_36330, _36332))
^  Call: (172) [system] sig_atomic(system:'$notrace'(_36330, _36332))
^  Exit: (171) [system] setup_call_cleanup(system:'$notrace'(3, -1), system:once(rtrace:retract(t_l:tracer_reset(tAt_normal))), system:'$restore_trace'(3, -1))
^  Call: (171) [rtrace] tAt(false, 271, 271, false)
...

If the number of lines is less (say 1980 instead of 1981) then the errors disappear. Likewise if the file is not converted to DOS format. Spooky, isn't?

@TeamSPoon
Copy link
Collaborator

TeamSPoon commented Dec 10, 2024

Aha thank you.. that is werid about the odd/even stuff

OK i am thinking about dos2unix-ing everyting anyways.. get ready for masive changes

@TeamSPoon
Copy link
Collaborator

Wild i had to add some newlines in VIM at the bottem of in order for dos2unix to work on that file..

~/metta-wam$ git commit -am "Yet another attempt to dos2unix everything"
[master 42b3e50] Yet another attempt to dos2unix everything
68 files changed, 11224 insertions(+), 11221 deletions(-)

@stassa
Copy link
Collaborator

stassa commented Dec 10, 2024

ngeiswei this could have been my fault - I use a windows-based IDE.

Did you find those stray \r's in any other file? I didn't commit anything to metta_envvars.sh. My last commit was in metta_repl.pl. Can you check whether that one has \r's for you please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that represent errors in the code
Projects
None yet
Development

No branches or pull requests

3 participants