Package: yaret
Version: 2.1.0-5

yaret dies on editor execution (and when editor execution is modified, on
other command execution) with indication that $? is -1, even though the
commands work.

I'm not exactly Perl-literate but the attached change (using a different
variable in place of $?) seems to help.

perldoc -v '$?' warns that
  If you have installed a signal handler for "SIGCHLD", the value of $? will 
usually be wrong
  outside that handler.
and yaret uses such handler.

I've been using yaret successfully before but maybe something in perl 5.14
caused the problem to be visible?

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (450, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/dash

Versions of packages yaret depends on:
ii  cdparanoia         3.10.2+debian-10
ii  flac               1.2.1-6
ii  libappconfig-perl  1.66-1
ii  libaudio-cd-perl   0.05-9+b2
ii  perl               5.14.2-6
ii  vorbis-tools       1.4.0-1

-- 
MichaƂ Politowski
Talking has been known to lead to communication if practiced carelessly.
--- /tmp/y/usr/bin/yaret	2006-03-05 20:32:29.000000000 +0100
+++ /usr/bin/yaret	2012-01-02 21:52:58.000000000 +0100
@@ -803,9 +803,9 @@
   my $tfile = new File::Temp(TEMPLATE=>'yaretXXXX', DIR=>$root_work, SUFFIX=>'.tmp');
   dump_cddb_file $tfile;
   $tfile->close;
-  $? = system $editor, "$tfile";
-  die sprintc $ERROR, "Could not run editor ($editor) [$?]"
-    if ($?);
+  my $system_status = system $editor, "$tfile";
+  die sprintc $ERROR, "Could not run editor ($editor) [$system_status]"
+    if ($system_status);
   my $fh = new IO::File("< $tfile");
   read_cddb_file $fh, 1; # 1 means overwrite previous information in memory
   $fh->close;
@@ -1008,10 +1008,10 @@
     my %keywords = (FILE_LIST=>$from);
     my $template = $config->normalize_command->{$normalize};
     my $command = make_substitution $template, 1, %keywords;
-    $? = 0;
-    $? = system "$command 2>/dev/null 1>/dev/null" if $command;
-    printc $ERROR, "Had an error on track ($track_num) doing '$command' [$?]"
-      if ($?);
+    my $system_status = 0;
+    $system_status = system "$command 2>/dev/null 1>/dev/null" if $command;
+    printc $ERROR, "Had an error on track ($track_num) doing '$command' [$system_status]"
+      if ($system_status);
   }
   for my $encoder (@{$config->encoder}) {
     my $to = "$root_work/$encoder-$track_num.wav";
@@ -1046,10 +1046,10 @@
     my $template = $config->encoder_command->{$s{name}};
     my $command = make_substitution $template, 1, %keywords;
     $workfile{$to} = 1;
-    $? = system "$command 2>/dev/null 1>/dev/null" if $command;
-    if ($?) {
+    my $system_status = system "$command 2>/dev/null 1>/dev/null" if $command;
+    if ($system_status) {
       unlink $to;
-      die sprintc $ERROR, "Had an error on track ($track_num) doing '$command' [$?]\n";
+      die sprintc $ERROR, "Had an error on track ($track_num) doing '$command' [$system_status]\n";
     } else {
       # we really do need to create this path everytime here...
       # perhaps the user does something weird like output_path = ARTIST/TRACK_NUM
@@ -1092,9 +1092,9 @@
     printc $START, "\u$settings{name} starting on: ($track_num) $track_name\n";
     send_message $parent, type=>'start', track=>$track_num;
   }
-  $? = system "$command 2>/dev/null 1>/dev/null";
-  printc $ERROR, "Had an error doing '$command' [$?]"
-    if ($?);
+  my $system_status = system "$command 2>/dev/null 1>/dev/null";
+  printc $ERROR, "Had an error doing '$command' [$system_status]"
+    if ($system_status);
   for my $filename (@found) {
     my ($track_num) = ($filename =~ /$track_regex/);
     my $track_name = get_cddb_attrib $track_num, "TRACK";

Reply via email to