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

default-packages doesn't install last package in file on Mac and Raspbian 12 #3382

Closed
MynockSpit opened this issue Jun 29, 2024 · 2 comments
Closed
Labels
bugs Oh no, something's broken :-(

Comments

@MynockSpit
Copy link

The command for ensuring a trailing new line in the list of default packages doesn't work in Mac and Raspbian 12. Instead it silently does nothing. This means that if you fail to put a new line in the default-packages file manually, the last package is ignored.

Notes

Command in nvm.sh:

$ echo '---'; echo -e "one\ntwo" | sed -e '$a\'; echo '---'
---
one
two
---

As an example (and not a replacement!) this is what it would look like on Mac and Raspbian 12.

$ echo '---'; echo -e "one\ntwo" | sed -e $'$a\\\n\\'; echo '---'
---
one
two

---

I'm no expert by any means, but perhaps an alternative such as while IFS="" read -r p || [ -n "$p" ] would work more broadly, and also wouldn't require rewriting the file into tmp.

Operating systems and versions:

Mac OS 14.2.1 (23C71) / nvm 0.39.7
Raspbian 12 / nvm 0.39.7

@MynockSpit
Copy link
Author

Update: After a little testing, it looks like the following command works on Raspi, but not on Mac.

Raspbian:

$ echo '---'; echo -e "one\ntwo" | sed -e '$a\\'; echo '---'
---
one
two

---

Mac:

$ echo '---'; echo -e "one\ntwo" | sed -e '$a\\'; echo '---'
---
sed: 1: "$a\\
": extra characters after \ at the end of a command
---

@ljharb
Copy link
Member

ljharb commented Jul 27, 2024

ok, i can definitely reproduce this, but the test in db19450 should be preventing it.

I'd definitely prefer to avoid the tempfile if possible.

@ljharb ljharb closed this as completed in 87a7097 Jul 28, 2024
@ljharb ljharb added the bugs Oh no, something's broken :-( label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-(
Projects
None yet
Development

No branches or pull requests

2 participants