Re: Vileserv on macOS issue

2022-12-20 Thread Brendan O'Dea
On Wed, 21 Dec 2022 at 09:33, Robert Sturrock  wrote:
> read(0x4, "/Users/rns/tmp/fortune-cookie.txt\n\n\0", 0x2000) = 35 > 0
> write(0x1, "/Users/rns/tmp/fortune-cookie.txt\n\n\n\0", 0x24)= 36 > 0

That looks pretty much what I would expect vileserv to do: it reads
from the socket, and writes to stdout, which is a pipe to the running
vile instance.

> Any clues as to where the issue might be or how I might be better debug this? 
>  I suspect I’m missing some obvious here!

Not quite sure what's going on.  You could also trace the vile
process, where you should see a corresponding read from the pipe.

In addition to that, I'd start putting some print statements into the
readfiles subroutine in Vileserv.pm.  Anything sent to stdout there
should appear in the messages buffer.  Make sure to ":set pm" first to
cause that buffer to popup.

Then just put lines in to see what's going wrong, say adding:

  print "Entering readfiles\n";

at the start of that subroutine (line 171), then:

  print "Got file $fileName\n";

after the "chomp $fileName;" statement.  Keep adding statements until
you find what is not working as expected.

About the only thing which springs to mind that may be a problem is
that the code uses newlines to delimit lines, and Macs at some point
used carriage returns.  Probably not the case since OS X though.

One unrelated, and slightly annoying thing that I noticed is that
printing to the minibuffer now elicits a warning.  Must look into what
changed in more recent Perl versions.

  :perl use warnings; print "foo\n";

for example produces a warning about an uninitialised value, almost
certainly in the guts of perl.xs.  I'll maybe poke at that over
Christmas.

--bod



Vileserv on macOS issue

2022-12-20 Thread Robert Sturrock
Hi All.

(Long time vile user here - many thanks to all those involved in the 
development).

I’m running vile-9.8w on macOS Big Sur (11.7.1), built from source with perl 
support.  I’m able to use many of the perl extras fine, but for some reason 
Vileserv does not seem to work, even though everything appears to be in place.  
I run a ’startserv’ to start it up, at which point I can see the socket and the 
server itself running as expected:

$ lsof ~/.vilesock
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
perl3245  rns3u  unix 0x9f24ff916129b7b7  0t0  
/Users/rns/.vilesock

$ ps -p 3245
  PID TTY   TIME CMD
 3245 ttys0050:00.03 vileserv

But when I try to edit a file, ‘vileget’ just exists (with success) but no new 
buffer is opened in the running vile instance:

$ vileget fortune-cookie.txt
$ echo $?
0

But a ‘dtruss’ on the vileserv process does indicate it’s opening the file:

$ sudo dtruss -p 3245
[…]
SYSCALL(args)= return
fcntl(0x4, 0x2, 0x1) = 0 0
fcntl(0x4, 0x2, 0x1) = 0 0
ioctl(0x4, 0x4004667A, 0x7FFEE87EC804)   = -1 Err#102
ioctl(0x4, 0x40487413, 0x7FFEE87EC808)   = -1 Err#102
lseek(0x4, 0x0, 0x1) = -1 Err#29
fcntl(0x4, 0x2, 0x1) = 0 0
ioctl(0x4, 0x4004667A, 0x7FFEE87EC804)   = -1 Err#102
ioctl(0x4, 0x40487413, 0x7FFEE87EC808)   = -1 Err#102
lseek(0x4, 0x0, 0x1) = -1 Err#29
read(0x4, "/Users/rns/tmp/fortune-cookie.txt\n\n\0", 0x2000) = 35 0
write(0x1, "/Users/rns/tmp/fortune-cookie.txt\n\n\n\0", 0x24)= 36 0
close(0x4)   = 0 0

Any clues as to where the issue might be or how I might be better debug this?  
I suspect I’m missing some obvious here!

Regards,

Robert.