On 5/21/23 08:47, Jonathan Billings wrote:
On May 20, 2023, at 22:18, Michael D. Setzer II <msetze...@gmail.com> wrote:
Recently was getting a strange error when running a script that didn't have
#!/usr/bin/bash at top?
free(): invalid next size (fast)
Aborted (core dumped)
Just adding the line fixes the issue, but not sure why??
Have run the script before with no such error, but had been a while? Script
was just one line? Now 2 lines.
#!/usr/bin/bash
boincmgr -e /home/msetzerii/BOINC -d /home/msetzerii/BOINC
So, the #! as the first two bytes of the shell script tells the OS that it is a
shell script and to invoke what follows with the file as a parameter. So in
your example, it will invoke /usr/bin/bash /path/to/script.sh.
Without the shebang (what we call ‘#!’), the OS looks at the ‘bo’ to identify
what kind of executable it is. That’s the first two bytes of the file, because
it starts with the text ‘boincmgr’.
By default, if the OS doesn’t recognize the file’s “magic number” (those two
first bytes), it executes it with /bin/sh by default.
Not quite. What happens is that your shell's exec() call fails with "ENOEXEC (Exec
format error)". When your shell (not the kernel) sees that for a file that does have
execute permission, it forks a copy of itself to try to interpret the file as a script in
your shell's own language. The result depends on whether the script is compatible with
your current shell.
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue