Re: Can anybody *please* fix #220044 - broken slave files (link)
tags 220044 + patch
thanks
Am Dienstag, den 18.12.2007, 20:40 +0000 schrieb Ian Jackson:
> Manuel Prinz writes ("Re: Can anybody *please* fix #220044 - broken slave files (link)"):
> > I spent some time on trying to fix it myself but failed because I lacked
> > of time to dive into u-a. I'd like to do some documentation or even
> > several changes to make the u-a code more readable, if this work is
> > appreciated.
>
> If you "lacked time" to fix it, why do you think it acceptable to
> berate the maintainers for their lack of time ?
Is it possible, that you wanted to flame *me* and not Manuel? He just
told, which issues are coming from this bug. I was the one that sent the
mail asking for response.
> If there were a well-tested and sensible fix, with a clear explanation
> of what the bug was and how the patch corrects it, which hadn't been
> merged, then you might well wonder whether the maintainers were
> properly performing their most critical and un-delegateable role,
> which is to be gatekeeper. But that's not the case here.
The problem is caused in config_alternatives() near line 680. There
simply the link in /etc/alternatives is created, but it is not checked,
if $slavelinks[$slnum] exists. Now there is some code at line 597 for
the "auto" action, that does, what we need in config_alternatives() too.
The question: Should this code be put into a new function? If we need it
twice, it IMHO makes sense. A patch is attached using this idea.
Please check it and tell me your opinion (e.g. if the coding style is
ok). I would simply adjust the patch, if you have concerns or
improvements. But then this bug can be closed.
> It is very rude to email bug reports to rant about how terrible it is
> that your bug hasn't been investigated.
Really, this sentence makes me some kind of angry. The OP reported the
issue 4 years ago. The issue can be easily reproduced. No reaction from
any dpkg maintainer. 1 year ago, I added a comment. No reaction. Now a
year later I ask again for any reaction. What do you expect me to do?
Wait for another 2-10 years just to see, if there ever will be a
reaction? I waited a year to ask again for a bug, that breaks things
(not for some wish I have). I don't know what's causing your offending
wording. What is "rude" in asking the third time in 4 years?
@Manuel: Please test the attached patch too, if you want and/or suggest
improvements. It works for me.
Regards, Daniel
--- /usr/sbin/update-alternatives.bk 2007-11-29 06:02:52.000000000 +0100
+++ /usr/sbin/update-alternatives 2007-12-19 00:37:18.000000000 +0100
@@ -229,6 +229,38 @@ sub check_many_actions()
badusage(sprintf(_g("two commands specified: %s and --%s"), $_, $action));
}
+sub checked_slave ($$$) {
+ my ($sname, $slink, $spath) = @_;
+ $linkname = readlink($slink);
+ if (!defined($linkname) && $! != ENOENT) {
+ pr(sprintf(_g("warning: %s is supposed to be a slave symlink to\n".
+ " %s, or nonexistent; however, readlink failed: %s"),
+ $slink, "$altdir/$sname", $!))
+ if $verbosemode > 0;
+ } elsif (!defined($linkname) ||
+ (defined($linkname) && $linkname ne "$altdir/$sname")) {
+ unlink("$slink.dpkg-tmp") || $! == ENOENT ||
+ quit(sprintf(_g("unable to ensure %s nonexistent: %s"),
+ "$slink.dpkg-tmp", $!));
+ symlink("$altdir/$sname","$slink.dpkg-tmp") ||
+ quit(sprintf(_g("unable to make %s a symlink to %s: %s"),
+ "$slink.dpkg-tmp", "$altdir/$sname", $!));
+ rename_mv("$slink.dpkg-tmp",$slink) ||
+ quit(sprintf(_g("unable to install %s as %s: %s"),
+ "$slink.dpkg-tmp", $slink, $!));
+ }
+ if (defined($linkname = readlink("$altdir/$sname")) && $linkname eq $spath) {
+ &pr(sprintf(_g("Leaving %s (%s) pointing to %s."), $sname, $slink, $spath))
+ if $verbosemode > 0;
+ } else {
+ &pr(sprintf(_g("Updating %s (%s) to point to %s."), $sname, $slink, $spath))
+ if $verbosemode > 0;
+ }
+ symlink("$spath","$altdir/$sname.dpkg-tmp") ||
+ &quit(sprintf(_g("unable to make %s a symlink to %s: %s"), "$altdir/$sname.dpkg-tmp", $spath, $!));
+ rename_mv("$altdir/$sname.dpkg-tmp","$altdir/$sname") ||
+ &quit(sprintf(_g("unable to install %s as %s: %s"), "$altdir/$sname.dpkg-tmp", "$altdir/$sname", $!));
+}
#
# Main program
@@ -595,35 +627,7 @@ if ($mode eq 'auto') {
unlink("$slink") || $! == &ENOENT ||
&quit(sprintf(_g("unable to remove %s: %s"), $slink, $!));
} else {
- $linkname = readlink($slink);
- if (!defined($linkname) && $! != ENOENT) {
- pr(sprintf(_g("warning: %s is supposed to be a slave symlink to\n".
- " %s, or nonexistent; however, readlink failed: %s"),
- $slink, "$altdir/$sname", $!))
- if $verbosemode > 0;
- } elsif (!defined($linkname) ||
- (defined($linkname) && $linkname ne "$altdir/$sname")) {
- unlink("$slink.dpkg-tmp") || $! == ENOENT ||
- quit(sprintf(_g("unable to ensure %s nonexistent: %s"),
- "$slink.dpkg-tmp", $!));
- symlink("$altdir/$sname","$slink.dpkg-tmp") ||
- quit(sprintf(_g("unable to make %s a symlink to %s: %s"),
- "$slink.dpkg-tmp", "$altdir/$sname", $!));
- rename_mv("$slink.dpkg-tmp",$slink) ||
- quit(sprintf(_g("unable to install %s as %s: %s"),
- "$slink.dpkg-tmp", $slink, $!));
- }
- if (defined($linkname= readlink("$altdir/$sname")) && $linkname eq $spath) {
- &pr(sprintf(_g("Leaving %s (%s) pointing to %s."), $sname, $slink, $spath))
- if $verbosemode > 0;
- } else {
- &pr(sprintf(_g("Updating %s (%s) to point to %s."), $sname, $slink, $spath))
- if $verbosemode > 0;
- }
- symlink("$spath","$altdir/$sname.dpkg-tmp") ||
- &quit(sprintf(_g("unable to make %s a symlink to %s: %s"), "$altdir/$sname.dpkg-tmp", $spath, $!));
- rename_mv("$altdir/$sname.dpkg-tmp","$altdir/$sname") ||
- &quit(sprintf(_g("unable to install %s as %s: %s"), "$altdir/$sname.dpkg-tmp", "$altdir/$sname", $!));
+ checked_slave ($sname, $slink, $spath);
}
}
}
@@ -677,9 +681,7 @@ sub config_alternatives {
for( my $slnum = 0; $slnum < @slavenames; $slnum++ ) {
my $slave = $slavenames[$slnum];
if ($slavepath{$preferred,$slnum} ne '') {
- checked_symlink($slavepath{$preferred,$slnum},
- "$altdir/$slave.dpkg-tmp");
- checked_mv("$altdir/$slave.dpkg-tmp", "$altdir/$slave");
+ checked_slave ($slave, $slavelinks[$slnum], $slavepath{$preferred,$slnum});
} else {
&pr(sprintf(_g("Removing %s (%s), not appropriate with %s."), $slave, $slavelinks[$slnum], $versions[$preferred]))
if $verbosemode > 0;
Reply to: