Your message dated Fri, 14 Oct 2022 03:15:20 +0200
with message-id <y0i4ke36y+lrv...@thunder.hadrons.org>
and subject line Re: Bug#77828: dpkg: [PATCH]: users should be able to use 
update-alternatives (not only root)
has caused the Debian Bug report #77828,
regarding u-a: Users should be able to use u-a (not only root)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
77828: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=77828
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: dpkg
Version: 1.7.2
Severity: wishlist
File: /usr/sbin/update-alternatives

Below is a small path and a small shell script which will from now on
use ~/.alternatives/<prog> if its available and fallback to
/etc/alternatives/<prog> if not.

WARNING:
I'm assuming that e.g. /usr/bin/foo will allways link to
/etc/alternatives/foo, if some foo links to /etc/alternatives/bar this
will break on the next update.

--------------------[ update-alternatives patch ]---------------------
--- /usr/sbin/update-alternatives.orig  Sun Dec 10 22:50:50 2000
+++ update-alternatives Sun Dec 10 23:35:08 2000
@@ -51,6 +51,7 @@
 sub quit { print STDERR "update-alternatives: @_\n"; exit(2); }
 sub badusage { print STDERR "update-alternatives: @_\n\n"; &usageversion; 
exit(2); }
 
+$alternative_prog='/bin/alternatives';
 $altdir= '/etc/alternatives';
 $admindir="/var/lib/dpkg" . '/alternatives';
 $testmode= 0;
@@ -271,6 +272,18 @@
             &quit("unable to rename $link to $alink: $!");
     }
     $link= $alink;
+    if (!defined($linkname= readlink($link)) && $! != &ENOENT) {
+      &pr("warning: $link is supposed to be a symlink to $alternative_prog\n".
+         " (or nonexistent); however, readlink failed: $!")
+       if $verbosemode > 0;
+    } elsif ($linkname ne "$alternative_prog") {
+      unlink("$link.dpkg-tmp") || $! == &ENOENT ||
+       &quit("unable to ensure $link.dpkg-tmp nonexistent: $!");
+      symlink("$alternative_prog","$link.dpkg-tmp") ||
+       &quit("unable to make $link.dpkg-tmp a symlink to $altdir/$name: $!");
+      rename_mv("$link.dpkg-tmp",$link) ||
+       &quit("unable to install $link.dpkg-tmp as $link: $!");
+    }
     if (!defined($i= $versionnum{$apath})) {
         push(@versions,$apath);
         $versionnum{$apath}= $i= $#versions;
@@ -404,13 +417,13 @@
         exit(0);
     } else {
         if (!defined($linkname= readlink($link)) && $! != &ENOENT) {
-            &pr("warning: $link is supposed to be a symlink to 
$altdir/$name\n".
+            &pr("warning: $link is supposed to be a symlink to 
$alternative_prog\n".
                 " (or nonexistent); however, readlink failed: $!")
               if $verbosemode > 0;
-        } elsif ($linkname ne "$altdir/$name") {
+        } elsif ($linkname ne "$alternative_prog") {
             unlink("$link.dpkg-tmp") || $! == &ENOENT ||
                 &quit("unable to ensure $link.dpkg-tmp nonexistent: $!");
-            symlink("$altdir/$name","$link.dpkg-tmp") ||
+            symlink("$alternative_prog","$link.dpkg-tmp") ||
                 &quit("unable to make $link.dpkg-tmp a symlink to 
$altdir/$name: $!");
             rename_mv("$link.dpkg-tmp",$link) ||
                 &quit("unable to install $link.dpkg-tmp as $link: $!");


----------------------------------------------------------------------
------------------------[ /bin/alternatives ]-------------------------
#!/bin/sh

PROG="`basename "$0"`"

if [ -e "$HOME/.alternatives/$PROG" ]; then
  exec ~/.alternatives/$PROG "$@"
  echo "WARNING: invalid user alternative defined for $PROG!"
fi

if [ -e "/etc/alternatives/$PROG" ]; then
  exec /etc/alternatives/$PROG "$@"
  echo "WARNING: invalid system alternative defined for $PROG!"
fi

echo "ERROR: no valid alternative defined for $PROG!"
exit 1
----------------------------------------------------------------------

MfG
        Goswin

-- System Information
Debian Release: woody
Architecture: i386
Kernel: Linux dual 2.2.17 #1 SMP Mon Sep 4 06:13:20 CEST 2000 i686

Versions of packages dpkg depends on:
ii  libc6                        2.2-4       GNU C Library: Shared libraries an
ii  libncurses5                  5.0-8       Shared libraries for terminal hand
ii  libstdc++2.10-glibc2.2       1:2.95.2-18 The GNU stdc++ library            



--- End Message ---
--- Begin Message ---
Hi!

On Sun, 2008-07-06 at 17:49:25 +0200, Raphael Hertzog wrote:
> tags 77828 - patch
> tags 77828 + wontfix
> thanks

> On Sat, 25 Nov 2000, Martin Quinson wrote:
> > Here is an (unified) patch against update-alternatives.pl as found today in
> > the CVS. Its purpose is to allow the users to manage an "alternative" system
> > on their account.
> 
> I'm not really inclined to support such a feature. I have yet to see a
> valid use case.
> 
> When the user wants to override a system-wide setting, there are already
> dozens of solutions going from using some environment variable to
> changing the PATH so that ~/bin/ is looked first. And ~/bin/ can contain
> symlinks corresponding to the various name of alternatives and have them
> point to their program of choice.

I do agree. As I see no point in keeping this around, I'll be closing
this request now. If this happens to be requested again then I guess
I'll create a FAQ entry.

Thanks,
Guillem

--- End Message ---

Reply via email to