On 3 Apr 2025, at 16:04, Michael Albinus wrote:

> Stacey Marshall <stacey.marsh...@gmail.com> writes:
>
> Hi Stacey,
>
> Thanks for this exhaustive bug report, and the proper analysis.
>
>
> Yep. According to the debug buffer you've sent, Tramp has sent the
> following command:
>
> --8<---------------cut here---------------start------------->8---
> 16:34:47.760152 tramp-send-command (6) # (if test -h 
> "/export/home/foobar/tmp/is_it_the_length_of_path_and_not_the_d/"; then echo 
> t; else echo nil; fi) && /usr/bin/readlink --canonicalize-missing 
> /export/home/foobar/tmp/is_it_the_length_of_path_and_not_the_d/ 2>/dev/null; 
> echo tramp_exit_status $?
> --8<---------------cut here---------------end--------------->8---
>
> The "(if test ... tramp_exit_status $?" sequence is 257 characters long,
> it seems to exceed the shell line length on Solaris. The problem is,
> that the looooongish file name is used twice.
>

truss running on the solaris system didn't see that arriving, it
would just hang in read:
--8<---------------cut here---------------start------------->8---
$ truss -eflda -rall -wall -p 2842
Base time stamp:  1743501145.234102  [ Tue Apr  1 09:52:25 UTC 2025 ]
2842/1:         psargs: /usr/bin/bash -noediting -norc -noprofile -i
2842/1:         read(0, 0x1FFCC6C5001008, 1024) (sleeping...)
2842/1:         23.318149    read(0, 0x1FFCC6C5001008, 1024)                    
= 19
2842/1:            e c h o   a r e   y o u   a w a k e\n
2842/1:         23.318506    write(1, 0x2E10054014, 14)                 = 14
2842/1:            a r e   y o u   a w a k e\n
2842/1:         23.318676    sigaction(SIGINT, 0xFFFFFC48DC9A7260, 
0xFFFFFC48DC9A7350) = 0
2842/1:         23.318769    write(2, 0x2E10050014, 37)                 = 37
2842/1:            / / / a a 2 a a 3 9 0 d c 7 2 9 2 a b 2 c c e b e a d 1 d 3 
3 9
2842/1:            1 3 7 # $
2842/1:         23.337019    read(0, 0x1FFCC6C5001008, 1024)                    
= 115
2842/1:            t e s t   - e   / h o m e / s m a r s h a l / t m p / t r a 
m p
2842/1:            / 3 / 1 2 3 4 5 6 7 8 / a b c d / d e f g h i j k l m / n o 
p q
2842/1:            r s t / a / h e l l o   2 > / d e v / n u l l ;   e c h o   
t r
2842/1:            a m p _ e x i t _ s t a t u s   $ ?\n
2842/1:         23.337289    openat(AT_FDCWD, "/dev/null", 
O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
2842/1:         23.337377    fcntl(2, F_GETFD)                          = 0
2842/1:         23.337425    fcntl(2, F_DUPFD, 0x0000000A)                      
= 10
2842/1:         23.337502    fcntl(2, F_GETFD)                          = 0
2842/1:         23.337551    fcntl(10, F_SETFD, 0x00000001)                     
= 0
2842/1:         23.337616    fcntl(4, F_DUP2FD, 0x00000002)                     
= 2
2842/1:         23.337668    close(4)                                   = 0
2842/1:         23.341470    fstatat(AT_FDCWD, 
"/home/smarshal/tmp/tramp/3/12345678/abcd/defghijklm/nopqrst/a/hello", 
0xFFFFFC48DC9A6A58, 0) = 0
2842/1:         23.341573    setcontext(0xFFFFFC48DC9A6510)
2842/1:         23.341644    fcntl(10, F_DUP2FD, 0x00000002)                    
= 2
2842/1:         23.341707    fcntl(10, F_GETFD)                         = 1
2842/1:         23.341754    close(10)                                  = 0
2842/1:         23.341841    write(1, 0x2E10054014, 20)                 = 20
2842/1:            t r a m p _ e x i t _ s t a t u s   0\n
2842/1:         23.341926    sigaction(SIGINT, 0xFFFFFC48DC9A7260, 
0xFFFFFC48DC9A7350) = 0
2842/1:         23.342022    write(2, 0x2E10050014, 37)                 = 37
2842/1:            / / / a a 2 a a 3 9 0 d c 7 2 9 2 a b 2 c c e b e a d 1 d 3 
3 9
2842/1:            1 3 7 # $
2842/1:         23.394900    read(0, 0x1FFCC6C5001008, 1024)                    
= 115
2842/1:            t e s t   - d   / h o m e / s m a r s h a l / t m p / t r a 
m p
2842/1:            / 3 / 1 2 3 4 5 6 7 8 / a b c d / d e f g h i j k l m / n o 
p q
2842/1:            r s t / a / h e l l o   2 > / d e v / n u l l ;   e c h o   
t r
2842/1:            a m p _ e x i t _ s t a t u s   $ ?\n
2842/1:         23.395270    openat(AT_FDCWD, "/dev/null", 
O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
2842/1:         23.395365    fcntl(2, F_GETFD)                          = 0
2842/1:         23.395415    fcntl(2, F_DUPFD, 0x0000000A)                      
= 10
2842/1:         23.395507    fcntl(2, F_GETFD)                          = 0
2842/1:         23.395556    fcntl(10, F_SETFD, 0x00000001)                     
= 0
2842/1:         23.395628    fcntl(4, F_DUP2FD, 0x00000002)                     
= 2
2842/1:         23.395683    close(4)                                   = 0
2842/1:         23.395807    fstatat(AT_FDCWD, 
"/home/smarshal/tmp/tramp/3/12345678/abcd/defghijklm/nopqrst/a/hello", 
0xFFFFFC48DC9A6A58, 0) = 0
2842/1:         23.395918    setcontext(0xFFFFFC48DC9A6510)
2842/1:         23.395993    fcntl(10, F_DUP2FD, 0x00000002)                    
= 2
2842/1:         23.396058    fcntl(10, F_GETFD)                         = 1
2842/1:         23.396112    close(10)                                  = 0
2842/1:         23.396258    write(1, 0x2E10054014, 20)                 = 20
2842/1:            t r a m p _ e x i t _ s t a t u s   1\n
2842/1:         23.396357    sigaction(SIGINT, 0xFFFFFC48DC9A7260, 
0xFFFFFC48DC9A7350) = 0
2842/1:         23.396457    write(2, 0x2E10050014, 37)                 = 37
2842/1:            / / / a a 2 a a 3 9 0 d c 7 2 9 2 a b 2 c c e b e a d 1 d 3 
3 9
2842/1:            1 3 7 # $
2842/1:         read(0, 0x1FFCC6C5001008, 1024) (sleeping...)
--8<---------------cut here---------------end--------------->8---

I shall look into that separately.

>> diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
....

> Yes. But this removes the performance optimization, to return both the
> information, whether a give file is a symlink, and its true name. This
> optimization avoids one round trip.
>
>> At this point I thought I should raise it with yourselves.
>
> Instead, I've puzzled the attached patch, which uses a shell function
> instead. Could you please check?
>

Thanks Michael, I knew you would have some alternative idea.
The patch provided does indeed work.

Thank you.


--
Stace

Reply via email to