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

using a file with CRLF with rc-service produces a "rc-service: No such file or directory" #733

Open
Vrtgs opened this issue Aug 23, 2024 · 5 comments

Comments

@Vrtgs
Copy link

Vrtgs commented Aug 23, 2024

whats even more bewidering is rc-update can handle it but not rc-service

@jaitaiwan
Copy link

Is this an actual problem though? Isn't Linux' default line ending LF?

@Vrtgs
Copy link
Author

Vrtgs commented Aug 27, 2024

yes but I don't think the proper error message to display should be "rc-service: No such file or directory" and its not like windows is some nice operating system, I have spent far too many hours trying to chase after what could possibly be wrong with the service that I uploaded, and why it was that when I just copy pasted the files contents from the file to a new one through the terminal the issue would disappear

I also believe the issue is not just that it doesn't support it, the issue is the terrible error message included as well
and the fact there is inconsistent behaviour between rc-update and rc-service

I would expect at least a warning that hey this file has CRLF and that isn't supported

@vapier
Copy link
Member

vapier commented Sep 1, 2024

please show the exact command you're running and exact output you're seeing. chances are these errors are not from openrc, they're from the kernel/shell, and there's nothing we can do about it, and it isn't unique to openrc.

@Vrtgs
Copy link
Author

Vrtgs commented Sep 1, 2024

please show the exact command you're running and exact output you're seeing. chances are these errors are not from openrc, they're from the kernel/shell, and there's nothing we can do about it, and it isn't unique to openrc.

I run rc-service "name" start and I get * rc-service: No such file or directory

@sertonix
Copy link

sertonix commented Sep 11, 2024

The problem is the carriage return on the first line. Linux considers this part of the executable name and therefor can't find it. The same happens with every shell script:

$ printf "#!/bin/sh\r\necho test\n" > file
$ chmod +x file
$ ./file
/bin/sh: ./file: not found

(here a reproducer for good measure)

$ printf '#!/sbin/openrc-run\r\necho test\n' | doas tee /etc/init.d/test
$ doas chmod +x /etc/init.d/test
$ doas rc-service test start
 * rc-service: No such file or directory

If you want to make people angry you can do ln -s openrc-run "$(printf '/sbin/openrc-run\r')" and say "it works on my machine" 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants