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>

Have done more testing, and found some interesting 
things?
I'm using the xfce-terminal and issue only seems to 
happen with it? gnome-terminal, mate-terminal, pterm 
and xterm and other seem to have no issues running the 

start1.sh
#!/usr/bin/bash
echo Start

or 
start2.sh
echo Start

Have filed a bug report with xfce-terminal.

running strace on ./start2.sh fails, but running the 
command directly with strace works?
./start2.sh 
free(): invalid next size (fast)
Aborted (core dumped)
[msetzerii@setzconote cabchk]$ ge start1.sh 
[msetzerii@setzconote cabchk]$ strace ./start2.sh 
execve("./start2.sh", ["./start2.sh"], 0x7ffe13c83ab0 /* 63 
vars */) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++

$ strace echo Start
execve("/usr/bin/echo", ["echo", "Start"], 
0x7ffd679077d8 /* 63 vars */) = 0
brk(NULL)                               = 0x55ff5655a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffe3d8b3240) = -1 
EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f13e6e2b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No 
such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", 
O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, 
st_size=201759, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 201759, PROT_READ, MAP_PRIVATE, 3, 
0) = 0x7f13e6df9000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", 
O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320v\2\0\
0\0\0\0"..., 832) = 832
pread64(3, 
"\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\
0\0\0"..., 784, 64) = 784
newfstatat(3, "", {st_mode=S_IFREG|0755, 
st_size=2224288, ...}, AT_EMPTY_PATH) = 0
pread64(3, 
"\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\
0\0\0"..., 784, 64) = 784
mmap(NULL, 1953104, PROT_READ, 
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f13e6c1c000
mmap(0x7f13e6c42000, 1400832, 
PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 
0x26000) = 0x7f13e6c42000
mmap(0x7f13e6d98000, 339968, PROT_READ, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 
0x17c000) = 0x7f13e6d98000
mmap(0x7f13e6deb000, 24576, 
PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 
0x1ce000) = 0x7f13e6deb000
mmap(0x7f13e6df1000, 32080, 
PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 
0x7f13e6df1000
close(3)                                = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f13e6c19000
arch_prctl(ARCH_SET_FS, 0x7f13e6c19740) = 0
set_tid_address(0x7f13e6c19a10)         = 1036951
set_robust_list(0x7f13e6c19a20, 24)     = 0
rseq(0x7f13e6c1a060, 0x20, 0, 0x53053053) = 0
mprotect(0x7f13e6deb000, 16384, PROT_READ) = 0
mprotect(0x55ff553b5000, 4096, PROT_READ) = 0
mprotect(0x7f13e6e60000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, 
{rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 
0
munmap(0x7f13e6df9000, 201759)          = 0
getrandom("\x25\x80\x23\x59\xbd\x87\x58\x60", 8, 
GRND_NONBLOCK) = 8
brk(NULL)                               = 0x55ff5655a000
brk(0x55ff5657b000)                     = 0x55ff5657b000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", 
O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, 
st_size=224104272, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 224104272, PROT_READ, MAP_PRIVATE, 
3, 0) = 0x7f13d9600000
close(3)                                = 0
newfstatat(1, "", {st_mode=S_IFCHR|0620, 
st_rdev=makedev(0x88, 0x5), ...}, AT_EMPTY_PATH) = 
0
write(1, "Start\n", 6Start
)                  = 6
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

So, not clear why the xfce-terminal has this issue??

Thanks for all replies.




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