Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the XML-XSH2 CPAN distribution.

Report information
The Basics
Id: 127082
Status: open
Priority: 0/
Queue: XML-XSH2

People
Owner: CHOROBA [...] cpan.org
Requestors: trantorvega [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.1.27
Fixed in: (no value)



Subject: Prompt not displayed in interactive mode due to file descriptor closure
Download (untitled) / with headers
text/plain 2.1k
Hello. Problem description following. Example: $ xsh -i ---------------------------------------- xsh - XML Editing Shell version 2.1.27 ---------------------------------------- Copyright (c) 2002 Petr Pajas. This is free software, you may use it and distribute it under either the GNU GPL Version 2, or under the Perl Artistic License. Using terminal type: Term::ReadLine::Gnu Hint: Type `help' or `help | less' to get more help. $scratch/> ls <?xml version='1.0' encoding='utf-8'?> <scratch/> Found 1 node(s). <?xml version='1.0' encoding='utf-8'?> <scratch/> Found 1 node(s). The output above is the one of two "ls" commands in sequence. As you can see the prompt is displayed only the first time. Afterwards there's no echo of the commands one inputs. Debugging and tracing syscalls I've narrowed it down to https://metacpan.org/source/CHOROBA/XML-XSH2-2.1.27/lib/XML/XSH2/Functions.pm#L256 Basically the open() call in the xsh_init function. Below an excerpt from the strace output [BEGIN STRACE] write(6, "\33[4m$scratch/> \33[24m", 20$scratch/> ) = 20 read(5, "l", 1) = 1 write(6, "l", 1l) = 1 read(5, "s", 1) = 1 write(6, "s", 1s) = 1 read(5, "\r", 1) = 1 write(6, "\n", 1 ) = 1 close(6) = 0 open("/usr/local/share/perl/5.22.1/XML/XSH2/Parser.pm", O_RDONLY) = 6 read(6, "{\n# GENERATE RECURSIVE DESCENT P"..., 8192) = 8192 [...] read(6, "", 8192) = 0 close(6) = 0 write(4, "<?xml version='1.0' encoding='ut"..., 39<?xml version='1.0' encoding='utf-8'?> ) = 39 write(4, "<scratch/>", 10<scratch/>) = 10 write(4, "\n", 1 ) = 1 write(2, "\n", 1 ) = 1 write(2, "Found ", 6Found ) = 6 write(2, "1", 11) = 1 write(2, " node(s).\n", 10 node(s). ) = 10 write(6, "\33[4m$scratch/> \33[24m", 20) = -1 EBADF (Bad file descriptor) [END STRACE] Apparently the output file descriptor is closed but the program is still trying to write the prompt and the echo of the inputted commands to it.
Download (untitled) / with headers
text/plain 317b
It works for me (also using Term::ReadLine::Gnu). I remember I had some problems with the prompt on cygwin, IIRC, it didn't display anything after the first command. There was a simple workaround I don't remember either, something like "echo | xsh -i". Could something like that solve the problem on your system, too?
Download (untitled) / with headers
text/plain 647b
Well, I am using a bash shell on Linux. From what I see, calling «xsh -i» with no file argument gives rise to the problem. Calling «xsh -i file» does not. So I imagine that there are assumptions in the code somewhere which fail once no file is loaded at startup. Il Sab 22 Set 2018 17:11:56, CHOROBA ha scritto: Show quoted text
> It works for me (also using Term::ReadLine::Gnu). I remember I had > some problems with the prompt on cygwin, IIRC, it didn't display > anything after the first command. There was a simple workaround I > don't remember either, something like "echo | xsh -i". Could something > like that solve the problem on your system, too?
Download (untitled) / with headers
text/plain 781b
Does it work with PERL_RL=ReadLine::Perl On Tue Sep 25 04:26:52 2018, trantorvega@gmail.com wrote: Show quoted text
> Well, I am using a bash shell on Linux. > From what I see, calling «xsh -i» with no file argument gives rise to > the problem. Calling «xsh -i file» does not. > So I imagine that there are assumptions in the code somewhere which > fail once no file is loaded at startup. > > Il Sab 22 Set 2018 17:11:56, CHOROBA ha scritto:
> > It works for me (also using Term::ReadLine::Gnu). I remember I had > > some problems with the prompt on cygwin, IIRC, it didn't display > > anything after the first command. There was a simple workaround I > > don't remember either, something like "echo | xsh -i". Could > > something > > like that solve the problem on your system, too?
Download (untitled) / with headers
text/plain 163b
I am having exactly this problem on two Ubuntu 18.04 machines (but curiously not on a third one). The suggested workaround of setting PERL_RL works for me, thanks.
Download (untitled) / with headers
text/plain 248b
On Thu Nov 28 08:55:38 2019, rrt wrote: Show quoted text
> but curiously not on a third one
And indeed on closer examination this is because the third machine is using ReadLine::Perl by default. So the problem appears to be with (the use of?) Term::ReadLine::Gnu


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.