On 5/21/23 14:09, Michael D. Setzer II via users wrote:
On 21 May 2023 at 16:05, Go Canes wrote:
From: Go Canes <letsgonhlcanes0(a)gmail.com>
Date sent: Sun, 21 May 2023 16:05:06 -0400
Subject: Re: Strange error running scripts. without
#!/usr/bin/bash
To: mikes(a)guam.net,
Community support for Fedora users
<users(a)lists.fedoraproject.org>
> On Sat, May 20, 2023 at 10:18 PM Michael D. Setzer II
> <msetzerii(a)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
>
> I understand that adding the shebang makes it likely that this was
> something to do with the script, but was wondering if somehow the
> "free" error was actually coming from boincmgr.
>
> Also, any chance in the past you invoked it as "sh script.sh" as
> opposed to "./script.sh"? And now you are just doing
"./script.sh"?
> That would explain the change in behavior.
Located the earlier script. It still gave the error so tried
strace and got
strace ./mktext2x.sh
execve("./mktext2x.sh", ["./mktext2x.sh"],
0x7ffc37e55570 /* 35 vars */) = -1 ENOEXEC (Exec
format error)
strace: exec: Exec format error
+++ exited with 1 +++
But always fails with strace without #! line?
The kernel can't exec a file that doesn't have a correct executable
format and strace doesn't have any fallback for if exec fails.