From: "Peter Baumann" <peter.baumann@gmail.com>
To: git@vger.kernel.org
Cc: "Martin Langhoff" <martin@catalyst.net.nz>,
"Yann Dirson" <ydirson@altern.org>
Subject: [BUG] git-cvsexportcommit doesn't handle added directories
Date: Fri, 27 Oct 2006 11:38:59 +0200 [thread overview]
Message-ID: <802d21790610270238l31042731t80313c8f467a1a55@mail.gmail.com> (raw)
There is a problem in git-cvsexportcommit if I add a directory with some new
files in git. It dies in safe_pipe_capture().
Analysis:
foreach my $f (@afiles) {
# This should return only one value
my @status = grep(m/^File/, safe_pipe_capture('cvs', '-q', 'status' ,$f));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# OK. Here it tries to run "cvs -q status src/newdirectory/newfile"
[...]
}
[...]
# An alternative to `command` that allows input to be passed as an array
# to work around shell problems with weird characters in arguments
# if the exec returns non-zero we die
sub safe_pipe_capture {
my @output;
if (my $pid = open my $child, '-|') {
@output = (<$child>);
print "before close\n";
close $child or die join(' ',@_).": x$!x y$?y";
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# I changed it to see which error will be printed
print "after close\n";
} else {
exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
}
return wantarray ? @output : join('',@output);
}
Output:
[...]
siprbaum@faui40a.informatik.uni-erlangen.de's password:
cvs [status aborted]: no such directory `src/newdir'
before close
cvs -q status src/newdir/newfile.java: xx y256y at
/home/peter/src/git-cvsexportcommit.perl line 317.
^^^^^
Don't be confused about the wrong line number. I have some other stuff
(formating
the commit message in a special way) in there but I can confirm that the script
dies at the close of the pipe.
Running from a shell the command manually:
xp:~/project/$ cvs -q status src/newdir/newfile
siprbaum@faui40a.informatik.uni-erlangen.de's password:
cvs [status aborted]: no such directory `src/newdir'
xp:~/project/$ echo $?
1
Excerpt from the "perldoc -f close"
[...]
If the file handle came from a piped open, "close" will additionally
return false if
one of the other system calls involved fails, or if the program
exits with non-zero
status. (If the only problem was that the program exited non-zero, $! will be
set to 0.) Closing a pipe also waits for the process executing on the pipe to
complete, in case you want to look at the output of the pipe afterwards, and
implicitly puts the exit status value of that command into $?.
Prematurely closing the read end of a pipe (i.e. before the process
writing to it
at the other end has closed it) will result in a SIGPIPE being
delivered to the
writer. If the other end can't handle that, be sure to read all the
data before
closing the pipe.
So according to the manpage $! should be set to 0, because
"cvs -q status src/newdir/newfile" exits with errorcode 1 as shown above.
Could this have something todo that I have to use ssh to connect to the repo?
(CVSROOT=:extssh:siprbaum@faui40a.informatik.uni-erlangen.de:/path/to/repo)
Any ideas?
Greetings,
reply other threads:[~2006-10-27 9:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=802d21790610270238l31042731t80313c8f467a1a55@mail.gmail.com \
--to=peter.baumann@gmail.com \
--cc=git@vger.kernel.org \
--cc=martin@catalyst.net.nz \
--cc=ydirson@altern.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).