LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2018, 11:04 AM   #1
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Rep: Reputation: 33
strange problem with the LESS command


i experience for a while a strange problem with the LESS command : each time i invoke it it wants to read my shell startup scripts, currently ~/.bash_profile, ~/.bashrc and so on. not only will that cost execution time but if there is an output from calling bash it will screw my less output. i am unable to locate where or why LESS wants to re-read my bash login scripts - instead of directly inherit the run parameters from the running shell.

my platform is slack142.

does anybody know of some help here ? bye, pisti
 
Old 08-01-2018, 11:21 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Noting that this is written by someone who never uses less ...

Have you investigated what gets called when you invoke less?

I mean, it's a command line binary. It does the opposite of more, which is also a command line binary.

I do a which and then subsequent ls -l, I see the following. I run Mint:
Code:
$ which less
/usr/bin/less
$
$ ls -l /usr/bin/less
lrwxrwxrwx 1 root root 9 Jun  6 17:13 /usr/bin/less -> /bin/less
$
$ ls -l /bin/less
-rwxr-xr-x 1 root root 170728 Apr  5  2017 /bin/less
$
$ less --version
less 481 (GNU regular expressions)
Copyright (C) 1984-2015  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
$
 
Old 08-01-2018, 11:39 AM   #3
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Original Poster
Rep: Reputation: 33
i have the same version of LESS on my box(es). it's located at /usr/bin/less but that shouldn't matter here.

i didn't change my system for 2 years but my bash files got changed evidently over the years. it's some environment variable that makes LESS read my bash files - but which one ?
 
Old 08-01-2018, 11:56 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I do not feel that there is any environment variable which affects less.

You can run a shell command from within less.

What evidence do you have that your statements are correct about this behavior?
 
Old 08-01-2018, 12:07 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
As an example, I said to myself, "They are stating that it is running their profile script ... hmmm that's bash stuff. OK, well I can turn on verbose, debug output from bash and see if I see anything ..."

So I typed "set -xv" at my bash prompt to show me more output, and then typed "less file[TAB]" (for name completion), and the shell went SWOOSH showing a bunch of stuff, but I typed it fast, not expecting that, and had hit enter to go into less.

"O ... K .... what was THAT?" So I exited less and pulled back my command prompt history. I found that all the stuff printed out was shell debug, and it was shell debug due to the command completion action.

So I next typed "less filename-all-typed-in-correctly-by-me.txt" and it did absolutely nothing except entered the less program.

That's one way to tell me that I do not see any shell execution other than what I typed, as part of that command evolution.
 
Old 08-01-2018, 12:18 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by rtmistler View Post
I do not feel that there is any environment variable which affects less.
The manpage for less lists 33 environment variables that affect its operation, though I don't see anything obvious that might cause a bunch of extra files to be opened.
 
Old 08-01-2018, 01:09 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Ah, so what you're highlighting is that there is an environment variable LESS as opposed to the less binary program.

Well then, should that be as simple as echoing the contents of that variable, and if there is anything in there, negating it via "LESS="?

@pisti,

Do you have an environment variable named LESS?
 
Old 08-01-2018, 01:33 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Wonder if some extra character is being added to the command???

I'd also try that command with full path too.
 
Old 08-01-2018, 01:51 PM   #9
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Original Poster
Rep: Reputation: 33
0) i tried to give the full path /usr/bin/less /FULLPATH/fname - no luck !

1) i had a "-M" in the LESS variable for reasons unclear to me (on multiple machines of mine, but not for any other user) :

Quote:
echo $LESS
-M
LESS=
echo $LESS
so, this cleared the $LESS variable, but no luck yet in getting less (binary) working...

2) the only LESS specific variable i use is :

Quote:
export LESSCHARSET=UTF-8
3) i am going to check now the 33(?) remaining environment variables...
 
Old 08-01-2018, 03:11 PM   #10
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Original Poster
Rep: Reputation: 33
ok, LESS problem solved : i had an text output (echo blabla) in one of my BASH setup files, first with a color output which gave the LESS variable this strange "-M" output :

Quote:
echo $LESS
-M
echo $LESS | wc
1 1 3
but taking out the colors didn't help much either as the output continued to disturb LESS. entirely removing this "echo something" solved the problem --> /usr/bin/less works again !

what worries me still is that if there is something to slow down the reading of my BASH setup files then that will also make LESS slow or sluggish... why are my BASH files read each time when LESS is invoked ?
 
Old 08-02-2018, 02:55 AM   #11
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,780

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
less should not start bash or open any bash files.
Run strace on it and see what it opens.
Code:
strace less ...

Last edited by MadeInGermany; 08-02-2018 at 02:56 AM.
 
Old 08-02-2018, 11:17 AM   #12
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Original Poster
Rep: Reputation: 33
i am a bit puzzled with this less/bash problem. i checked this scenario on several unrelated linux boxes (all running Slackware 14.2) with several user accounts : whenever there is a verbose output from bash files (for example in ~/.bashrc) then LESS will fail and not show a text file in question ("hello world") but show bash's output string ("bash hello world").

i don't know how to interpret these strace outputs - therefore i include here two such outputs. the 1st one without bash echo :

Code:
execve("/usr/bin/less", ["less", "test_less"], [/* 43 vars */]) = 0
brk(NULL)                               = 0x1c45000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb76dd7a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=231798, ...}) = 0
mmap(NULL, 231798, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb76dd41000
close(3)                                = 0
open("/lib64/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200H\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=420552, ...}) = 0
mmap(NULL, 2518864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb76d8f0000
mprotect(0x7fb76d952000, 2097152, PROT_NONE) = 0
mmap(0x7fb76db52000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x62000) = 0x7fb76db52000
close(3)                                = 0
open("/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\360\10\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2076848, ...}) = 0
mmap(NULL, 3967456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb76d527000
mprotect(0x7fb76d6e7000, 2093056, PROT_NONE) = 0
mmap(0x7fb76d8e6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7fb76d8e6000
mmap(0x7fb76d8ec000, 14816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb76d8ec000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=18808, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb76dd40000
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb76d323000
mprotect(0x7fb76d326000, 2093056, PROT_NONE) = 0
mmap(0x7fb76d525000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fb76d525000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb76dd3f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb76dd3e000
arch_prctl(ARCH_SET_FS, 0x7fb76dd3f700) = 0
mprotect(0x7fb76d8e6000, 16384, PROT_READ) = 0
mprotect(0x7fb76d525000, 4096, PROT_READ) = 0
mprotect(0x7fb76dd7b000, 4096, PROT_READ) = 0
munmap(0x7fb76dd41000, 231798)          = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(NULL)                               = 0x1c45000
brk(0x1c66000)                          = 0x1c66000
stat("/home/ipmsa/.terminfo", 0x1c451b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/usr/share/terminfo/x/xterm-color", R_OK) = 0
open("/usr/share/terminfo/x/xterm-color", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1435, ...}) = 0
read(3, "\32\0019\0\17\0\20\0i\1U\2xterm-color|generic "..., 4096) = 1435
read(3, "", 4096)                       = 0
close(3)                                = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=52, ws_col=228, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=52, ws_col=228, ws_xpixel=0, ws_ypixel=0}) = 0
open("/usr/bin/.sysless", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/etc/sysless", O_RDONLY)          = -1 ENOENT (No such file or directory)
open("/home/ipmsa/.less", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/home/ipmsa/.lesshst", O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=952, ...}) = 0
read(3, ".less-history-file:\n.search\n\"MTT"..., 4096) = 952
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/dev/tty", O_RDONLY)              = 3
ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fsync(3)                                = -1 EINVAL (Invalid argument)
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig -icanon -echo ...}) = 0
rt_sigaction(SIGINT, {0x415c70, [INT], SA_RESTORER|SA_RESTART, 0x7fb76d55c480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTSTP, {0x415c20, [TSTP], SA_RESTORER|SA_RESTART, 0x7fb76d55c480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGWINCH, {0x415bd0, [WINCH], SA_RESTORER|SA_RESTART, 0x7fb76d55c480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [QUIT], SA_RESTORER|SA_RESTART, 0x7fb76d55c480}, {SIG_DFL, [], 0}, 8) = 0
pipe2([4, 5], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fb76dd3f9d0) = 16815
close(5)                                = 0
fcntl(4, F_SETFD, 0)                    = 0
read(4, "", 1)                          = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16815, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
close(4)                                = 0
wait4(16815, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16815
stat("test_less", {st_mode=S_IFREG|0660, st_size=12, ...}) = 0
stat("test_less", {st_mode=S_IFREG|0660, st_size=12, ...}) = 0
open("test_less", O_RDONLY)             = 4
lseek(4, 1, SEEK_SET)                   = 1
lseek(4, 0, SEEK_SET)                   = 0
read(4, "hello world\n", 256)           = 12
lseek(4, 1, SEEK_SET)                   = 1
fstat(4, {st_mode=S_IFREG|0660, st_size=12, ...}) = 0
lseek(4, 0, SEEK_SET)                   = 0
stat("test_less", {st_mode=S_IFREG|0660, st_size=12, ...}) = 0
write(1, "\0337\33[?47h\33[?1h\33=\r", 16) = 16
read(4, "hello world\n", 8192)          = 12
write(1, "hello world\n\33[7mtest_less lines "..., 49) = 49
read(3, "q", 1)                         = 1
close(4)                                = 0
write(1, "\r\33[K\33[?1l\33>\33[2J\33[?47l\0338", 23) = 23
fsync(3)                                = -1 EINVAL (Invalid argument)
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
exit_group(0)                           = ?
+++ exited with 0 +++
and the 2nd one with a bash echo "bash hello world" :

Code:
execve("/usr/bin/less", ["less", "test_less"], [/* 43 vars */]) = 0
brk(NULL)                               = 0xe90000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0315966000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=231798, ...}) = 0
mmap(NULL, 231798, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f031592d000
close(3)                                = 0
open("/lib64/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200H\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=420552, ...}) = 0
mmap(NULL, 2518864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f03154dc000
mprotect(0x7f031553e000, 2097152, PROT_NONE) = 0
mmap(0x7f031573e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x62000) = 0x7f031573e000
close(3)                                = 0
open("/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\360\10\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2076848, ...}) = 0
mmap(NULL, 3967456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0315113000
mprotect(0x7f03152d3000, 2093056, PROT_NONE) = 0
mmap(0x7f03154d2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f03154d2000
mmap(0x7f03154d8000, 14816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f03154d8000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=18808, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f031592c000
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0314f0f000
mprotect(0x7f0314f12000, 2093056, PROT_NONE) = 0
mmap(0x7f0315111000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f0315111000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f031592b000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f031592a000
arch_prctl(ARCH_SET_FS, 0x7f031592b700) = 0
mprotect(0x7f03154d2000, 16384, PROT_READ) = 0
mprotect(0x7f0315111000, 4096, PROT_READ) = 0
mprotect(0x7f0315967000, 4096, PROT_READ) = 0
munmap(0x7f031592d000, 231798)          = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(NULL)                               = 0xe90000
brk(0xeb1000)                           = 0xeb1000
stat("/home/ipmsa/.terminfo", 0xe901b0) = -1 ENOENT (No such file or directory)
stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/usr/share/terminfo/x/xterm-color", R_OK) = 0
open("/usr/share/terminfo/x/xterm-color", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1435, ...}) = 0
read(3, "\32\0019\0\17\0\20\0i\1U\2xterm-color|generic "..., 4096) = 1435
read(3, "", 4096)                       = 0
close(3)                                = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=52, ws_col=228, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TIOCGWINSZ, {ws_row=52, ws_col=228, ws_xpixel=0, ws_ypixel=0}) = 0
open("/usr/bin/.sysless", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/etc/sysless", O_RDONLY)          = -1 ENOENT (No such file or directory)
open("/home/ipmsa/.less", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/home/ipmsa/.lesshst", O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=952, ...}) = 0
read(3, ".less-history-file:\n.search\n\"MTT"..., 4096) = 952
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/dev/tty", O_RDONLY)              = 3
ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fsync(3)                                = -1 EINVAL (Invalid argument)
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig -icanon -echo ...}) = 0
rt_sigaction(SIGINT, {0x415c70, [INT], SA_RESTORER|SA_RESTART, 0x7f0315148480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTSTP, {0x415c20, [TSTP], SA_RESTORER|SA_RESTART, 0x7f0315148480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGWINCH, {0x415bd0, [WINCH], SA_RESTORER|SA_RESTART, 0x7f0315148480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [QUIT], SA_RESTORER|SA_RESTART, 0x7f0315148480}, {SIG_DFL, [], 0}, 8) = 0
pipe2([4, 5], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f031592b9d0) = 17437
close(5)                                = 0
fcntl(4, F_SETFD, 0)                    = 0
read(4, "b", 1)                         = 1
stat("-", 0x7fff63384240)               = -1 ENOENT (No such file or directory)
write(1, "\0337\33[?47h\33[?1h\33=\r", 16) = 16
read(4, "ash hello world\n", 8191)      = 16
write(1, "bash hello world\n", 17)      = 17
read(4, "", 8175)                       = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17437, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
write(1, "\33[7mtest_less lines 1-1/1 (END)\33"..., 37) = 37
read(3, "q", 1)                         = 1
close(4)                                = 0
wait4(17437, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 17437
write(1, "\r\33[K\33[?1l\33>\33[2J\33[?47l\0338", 23) = 23
fsync(3)                                = -1 EINVAL (Invalid argument)
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
exit_group(0)                           = ?
+++ exited with 0 +++
the problem is somewhere around 'read(4...', with values of 0 (GOOD) or 1 (BAD, the letter "b" comes from the bash output).

Code:
read(4, "", 1)                          = 0
Code:
read(4, "b", 1)                         = 1
i know for a fact that the bash files get re-read with each call of /usr/bin/less - on each machine and for each user tested. why is this the case ? is it a Slackware 'feature' ?

any feedback much appreciated !
 
Old 08-02-2018, 11:54 AM   #13
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,780

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
We have to look beyond the clone()
Please run
Code:
strace -s 128 -f -e execve,clone less ...
 
Old 08-02-2018, 12:13 PM   #14
pisti
Member
 
Registered: Jul 2006
Location: Montréal, Canada
Distribution: Slackware
Posts: 258

Original Poster
Rep: Reputation: 33
i begin to realize that there is a lesspipe.sh pre-processor script involved here. that's perhaps something Slackware specific... there is also a LESSOPEN environment variable that makes lesspipe.sh conveniently open all kind compressed files before /usr/bin/less is invoked :

Code:
LESSOPEN=|lesspipe.sh %s
here the strace output you MadeInGermany asked for :

Code:
strace -o outputfile -s 128 -f -e execve,clone less test_less
Code:
18376 execve("/usr/bin/less", ["less", "test_less"], [/* 43 vars */]) = 0
18376 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f71204339d0) = 18377
18377 execve("/bin/sh", ["sh", "-c", "/bin/bash -c lesspipe.sh\\ test_less"], [/* 43 vars */]) = 0
18377 execve("/bin/bash", ["/bin/bash", "-c", "lesspipe.sh test_less"], [/* 41 vars */]) = 0
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18378
18378 execve("/usr/bin/xmodmap", ["xmodmap", "-e", "keycode 64 = BackSpace"], [/* 41 vars */]) = 0
18378 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18378, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18379
18379 execve("/usr/bin/xmodmap", ["xmodmap", "-e", "keycode 12 = Alt_L"], [/* 41 vars */]) = 0
18379 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18379, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18380
18380 execve("/usr/bin/xmodmap", ["xmodmap", "-e", "keysym Alt_L = Meta_L Alt_L"], [/* 41 vars */]) = 0
18380 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18380, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18381
18381 execve("/usr/bin/setxkbmap", ["setxkbmap", "-layout", "us,hu,ca", "-variant", "fr", "-option", "grp:switch,grp:shift_toggle,grp_led:sc
roll"], [/* 41 vars */]) = 0
18381 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18381, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18382
18382 execve("/usr/bin/xgamma", ["xgamma", "-quiet", "-gamma", "1.15"], [/* 41 vars */]) = 0
18382 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18382, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1632529d0) = 18383
18383 execve("/usr/bin/xmodmap", ["xmodmap", "-e", "pointer = 1 8 3 4 5 0 0 2"], [/* 41 vars */]) = 0
18383 +++ exited with 0 +++
18377 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18383, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18377 execve("/usr/bin/lesspipe.sh", ["lesspipe.sh", "test_less"], [/* 41 vars */]) = 0
18377 +++ exited with 0 +++
18376 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18377, si_uid=500, si_status=0, si_utime=0, si_stime=0} ---
18376 +++ exited with 0 +++
vielen Dank im voraus, tschüß !
 
Old 08-02-2018, 12:43 PM   #15
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,780

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
Yes, there is a bug in your /usr/bin/less.
This bug is also in CentOS.
The bug is that it invokes an extra /bin/bash here:
Code:
execve("/bin/sh", ["sh", "-c", "/bin/bash -c lesspipe.sh\\ test_less"]
Correct would be
Code:
execve("/bin/sh", ["sh", "-c", "lesspipe.sh test_less"]
And of course any "bash"isms need to be removed from /usr/bin/lesspipe.sh.
Now, somehow you trigger the bug.
Perhaps you have set BASH_ENV to something?
Code:
echo $BASH_ENV
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
more command strange behaviour sancho1980 Linux - Newbie 2 03-12-2008 07:05 AM
Strange IP coming from Last -i Command 69_rs_ss Linux - Security 10 12-31-2004 03:14 PM
A strange command Gins Linux - General 8 11-17-2004 01:41 PM
strange, strange alsa problem: sound is grainy/pixellated? fenderman11111 Linux - Software 1 11-01-2004 05:16 PM
ls -R command is working strange xailer Linux - Newbie 4 11-25-2003 07:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration