LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-21-2018, 08:16 AM   #1
andygoth
Member
 
Registered: Sep 2017
Distribution: Slackware
Posts: 132

Rep: Reputation: 66
upgradepkg and *.orig


Whenever upgrading with upgradepkg, replaced configuration files may be backed up with a ".orig" extension. This is a nice feature, but there's a minor issue. A fresh Slackware 14.2 install contains several files named *.orig, so it becomes a little tricky to tell the difference between backup files (which can be deleted after examination) and standard distribution files (which should be left alone).

As of time of writing, Slackware does not contain any files named *.ORIG. Perhaps ".ORIG" would be a better extension to use to unambiguously denote configuration file backups.

I just did an upgrade to Slackware-current from a fresh Slackware-14.2 (32-bit) and compared the list of *.orig files before-and-after. In the before column, there is /etc/kde/kdm/Xsession.orig, which a casual "find /etc -name \*.orig -delete" would unfairly zap. There are also three files named *.orig in /usr/doc and fifteen in /usr/share. It may seem the solution to the latter is to ignore *.orig in /usr, except that the upgrade created /usr/share/vim/vimrc.orig, which may be worth examining, merging, and deleting.

Similar goes for ".new" versus ".NEW". Following the upgrade, I found seven files named "*.new", despite not having selected "n" when asked what to do with configuration files. These files can also cause confusion, but not if upgradepkg used the ".NEW" extension instead.

(I didn't realize this at first, but installpkg is also capable of replacing configuration files and will name them *.orig or *.new too.)

Last edited by andygoth; 06-21-2018 at 09:06 AM. Reason: installpkg
 
Old 06-21-2018, 02:24 PM   #2
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Quote:
Originally Posted by andygoth View Post
Whenever upgrading with upgradepkg, replaced configuration files may be backed up with a ".orig" extension.

[...]

(I didn't realize this at first, but installpkg is also capable of replacing configuration files and will name them *.orig or *.new too.)
There's no feature in either installpkg or upgradepkg to create .orig files.
 
Old 06-21-2018, 03:48 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by volkerdi View Post
There's no feature in either installpkg or upgradepkg to create .orig files.
I'm thinking he meant slackpkg when you upgrade a package and it then prompts you what to do about changed config files.
 
Old 06-21-2018, 08:05 PM   #4
andygoth
Member
 
Registered: Sep 2017
Distribution: Slackware
Posts: 132

Original Poster
Rep: Reputation: 66
Quote:
Originally Posted by bassmadrigal View Post
I'm thinking he meant slackpkg when you upgrade a package and it then prompts you what to do about changed config files.
Right. I incorrectly assumed that since slackpkg wraps installpkg and upgradepkg, the latter two were handing the *.orig and *.new file creation. You're telling me slackpkg manages that internally. Either way, I stand by my request to rename to *.ORIG and *.NEW to avoid ambiguity with files that ship with Slackware.
 
Old 06-22-2018, 12:49 AM   #5
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
This is a longstanding slackpkg thing, and while I wouldn't have done it that way if I'd originally written it (I wouldn't save the .orig files at all - if you say to overwrite the originals with the .new files, then that's what you get) ; however, at this point, inertia wins.
 
Old 06-22-2018, 01:02 AM   #6
andygoth
Member
 
Registered: Sep 2017
Distribution: Slackware
Posts: 132

Original Poster
Rep: Reputation: 66
Quote:
Originally Posted by rworkman View Post
This is a longstanding slackpkg thing, and while I wouldn't have done it that way if I'd originally written it (I wouldn't save the .orig files at all - if you say to overwrite the originals with the .new files, then that's what you get) ; however, at this point, inertia wins.
I don't see any reason why slackpkg can't be extended with new options or menu choices to customize this behavior.

While we're on the subject of new functionality, it might also be nice to have the option to only write .orig or .new files in the case where the original file on disk differs from what was originally supplied by the old version of the package. I'm not sure if there's a database of checksums for old packages lying around within easy reach, but if there is, this would be a good use for it. Basically, the only time I really care about .orig files is when they afford me the opportunity to merge in my local changes. But if I haven't made any local changes, I'm happy to upgrade away and don't look back! Until things break, of course, at which point I downgrade the whole package rather than just the configuration file.
 
Old 06-22-2018, 03:55 AM   #7
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
That would be at least marginally useful, but out of scope for slackpkg. If that were going to be done, it would be in pkgtools and probably along these lines:
If /etc/someconfig is identical to the /etc/someconfig.new that was contained in the to-be-upgraded version of the package, then overwrite /etc/someconfig with
the /etc/someconfig.new from the upgraded package, i.e. don't even install a .new file. As far as I'm concerned, that would be a welcome change, but the infrastructure to do it is not currently in place. As to whether it's worth adding that infrastructure for the perceived benefit, I'm not sure.
 
Old 06-22-2018, 10:05 AM   #8
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by rworkman View Post
That would be at least marginally useful, but out of scope for slackpkg. If that were going to be done, it would be in pkgtools and probably along these lines:
If /etc/someconfig is identical to the /etc/someconfig.new that was contained in the to-be-upgraded version of the package, then overwrite /etc/someconfig with
the /etc/someconfig.new from the upgraded package, i.e. don't even install a .new file. As far as I'm concerned, that would be a welcome change, but the infrastructure to do it is not currently in place. As to whether it's worth adding that infrastructure for the perceived benefit, I'm not sure.
Isn't this already done in the config() function of doinst.sh?

Code:
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
(Although, in this case, it actually just removes the .new file since they are the same. It could easily be adjusted to move the .new file over the existing file.
 
Old 06-22-2018, 12:04 PM   #9
andygoth
Member
 
Registered: Sep 2017
Distribution: Slackware
Posts: 132

Original Poster
Rep: Reputation: 66
I was talking about an option to not create .orig or .new files, just replace the file, if the file being replaced matches what was in the old version of the package being updated. In other words, if the user didn't modify it, just go ahead and upgrade it, on the theory that the user didn't need to do any merging. The code you show is to avoid creating .orig or .new files if the file being replaced matches what's in the new version of the package.

Also, why compare MD5 checksums? Why not just compare the files with cmp?
 
Old 06-22-2018, 12:46 PM   #10
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by andygoth View Post
I was talking about an option to not create .orig or .new files, just replace the file, if the file being replaced matches what was in the old version of the package being updated. In other words, if the user didn't modify it, just go ahead and upgrade it, on the theory that the user didn't need to do any merging. The code you show is to avoid creating .orig or .new files if the file being replaced matches what's in the new version of the package.
Replacing the file if there were just no changes to the original would require creating a new database (or adding to a current one) to store hashes of the original file. Plus, there's times when an upgraded config may drastically change the expected behavior of a package. An example of this is when openssh was upgraded to fix a security issue in 14.1, but the new config prevented root logins with passwords, which could potentially lock people out of their systems if they're remote.

Code:
Fri Jan 15 02:29:54 UTC 2016
patches/packages/openssh-7.1p2-x86_64-1_slack14.1.txz:  Upgraded.
  This update fixes an information leak and a buffer overflow.  In particular,
  the information leak allows a malicious SSH server to steal the client's
  private keys.  Thanks to Qualys for reporting this issue.
  For more information, see:
    https://www.qualys.com/2016/01/14/cve-2016-0777-cve-2016-0778/openssh-cve-2016-0777-cve-2016-0778.txt
    http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0777
    http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0778
  *****************************************************************
  * IMPORTANT:  READ BELOW ABOUT POTENTIALLY INCOMPATIBLE CHANGES *
  *****************************************************************
  Rather than backport the fix for the information leak (which is the only
  hazardous flaw), we have upgraded to the latest OpenSSH.  As of version
  7.0, OpenSSH has deprecated some older (and presumably less secure)
  algorithms, and also (by default) only allows root login by public-key,
  hostbased and GSSAPI authentication.  Make sure that your keys and
  authentication method will allow you to continue accessing your system
  after the upgrade.
  The release notes for OpenSSH 7.0 list the following incompatible changes
  to be aware of:
  * Support for the legacy SSH version 1 protocol is disabled by
    default at compile time.
  * Support for the 1024-bit diffie-hellman-group1-sha1 key exchange
    is disabled by default at run-time. It may be re-enabled using
    the instructions at http://www.openssh.com/legacy.html
  * Support for ssh-dss, ssh-dss-cert-* host and user keys is disabled
    by default at run-time. These may be re-enabled using the
    instructions at http://www.openssh.com/legacy.html
  * Support for the legacy v00 cert format has been removed.
  * The default for the sshd_config(5) PermitRootLogin option has
    changed from "yes" to "prohibit-password".
  * PermitRootLogin=without-password/prohibit-password now bans all
    interactive authentication methods, allowing only public-key,
    hostbased and GSSAPI authentication (previously it permitted
    keyboard-interactive and password-less authentication if those
    were enabled).
  (* Security fix *)
 
  


Reply

Tags
upgradepkg



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where to find the sources of kfind 3.3.2 orig.tar.gz? patrick295767 Debian 1 06-12-2016 04:51 PM
[SOLVED] systemd needs orig. dvd in place theosch Fedora 3 10-19-2013 03:07 PM
Xsetup_0.orig, Xsession.orig? no original file glorsplitz Slackware 1 07-08-2013 08:51 AM
installing libxml-parser-perl_2.34.orig.tar andreas_skw Linux - Newbie 6 05-07-2008 11:42 PM
Q- Reinstall Suse from orig CD or just put in & use HD from old PC as is? pwwatso Linux - Newbie 0 10-15-2004 06:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration