Re: Strange error running scripts. without #!/usr/bin/bash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 May 2023 at 16:05, Go Canes wrote:

From:           	Go Canes <letsgonhlcanes0@xxxxxxxxx>
Date sent:      	Sun, 21 May 2023 16:05:06 -0400
Subject:        	Re: Strange error running scripts. without 
#!/usr/bin/bash
To:             	mikes@xxxxxxxx, 
	Community support for Fedora users 
<users@xxxxxxxxxxxxxxxxxxxxxxx>

> On Sat, May 20, 2023 at 10:18 PM Michael D. Setzer II
> <msetzerii@xxxxxxxxx> 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 running the corrected one ran fine as is and with 
strace.

But then tried to run it again, and mktext2x.sh runs 
without error?

Running the one with bash line, strace works fine.
strace ./mktext2.sh 
execve("./mktext2.sh", ["./mktext2.sh"], 0x7ffc9afbcb80 
/* 63 vars */) = 0
brk(NULL)                               = 0x55a016794000

The script is:
#!/usr/bin/bash
for a in $(ls -1rt status_cgi*); do
   n=$(echo "$a" | sed 's/status_cgi.//g;s/status_cgi//g'); 
   html2text  -b0 "$a" >text."$n" ;
   grep "^Downstream"  <text."$n" | sed 's/[[:alpha:]|]//g;s/^ //g;s/  / /g' | cut -f1,4,5,9 -d' ' >down."$n" ;
done

So, why it seems to always work with the #! line,
but seems to randomly work without it?
But always fails with strace without #! line?

Extracting cable modem status info for many saved 
status_cgi files.

Strange that it isn't consistant?

+------------------------------------------------------------+
 Michael D. Setzer II - Computer Science Instructor 
(Retired)     
 mailto:mikes@xxxxxxxx                            
 mailto:msetzerii@xxxxxxxxx
 Guam - Where America's Day Begins                        
 G4L Disk Imaging Project maintainer 
 http://sourceforge.net/projects/g4l/
+------------------------------------------------------------+


_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux