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:52, Roger Heflin wrote:

From:           	Roger Heflin <rogerheflin@xxxxxxxxx>
Date sent:      	Sun, 21 May 2023 16:52:56 -0500
Subject:        	Re: Strange error running scripts. without 
#!/usr/bin/bash
To:             	Community support for Fedora users 
<users@xxxxxxxxxxxxxxxxxxxxxxx>
Send reply to:  	Community support for Fedora 
users <users@xxxxxxxxxxxxxxxxxxxxxxx>

> You should be able to add -f (follow all forks) on strace and it will
> follow everything.   But without the script tracing POC mentions you
> aren't really going to know what line gets the error.
> 
> It is likely the bug is in one of the commands you are using, and it
> may depend on the data you are getting and processing.
> 

As a test, I put an echo command at start of program.

echo START
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


./mktext2x.sh 
free(): invalid next size (fast)
Aborted (core dumped)

Never displays START??


The other version prints the Start and runs fine.
#!/usr/bin/bash
echo Start
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

Everything else is exactly the same.
Currently have status_cgi thru status_cgi.321 so 322 
files. 

Another simpler test.
cat start1.sh
#!/usr/bin/bash
echo Start
cat start2.sh
echo Start
$ ./start1.sh
Start
$ ./start2.sh
free(): invalid next size (fast)
Aborted (core dumped)

So, nothing but an echo command??



> On Sun, May 21, 2023 at 4:39 PM Patrick O'Callaghan
> <pocallaghan@xxxxxxxxx> wrote:
> >
> > On Mon, 2023-05-22 at 07:09 +1000, Michael D. Setzer II via users
> > wrote:
> > > 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
> > >
> >
> > AFAIK what you're tracing here is the Shell itself, not the script
> > (except indirectly), which is unlikely to be useful in most cases.
> >
> > You can do some tracing of Shell scripts. See for example
> > https://www.tecmint.com/trace-shell-script-execution-in-linux/
> >
> > poc
> > _______________________________________________
> > 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
> _______________________________________________
> 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


+------------------------------------------------------------+
 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