Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 589488 - net-fs/nfs-utils: use of REPLACING_VERSIONS does not account for multiple values
Summary: net-fs/nfs-utils: use of REPLACING_VERSIONS does not account for multiple values
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal QA (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: QAcanfix
Depends on:
Blocks: 589444
  Show dependency tree
 
Reported: 2016-07-23 12:49 UTC by Michał Górny
Modified: 2019-09-02 07:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixed the issue with REPLACING_VERSIONS regarding the >1.3.0 or none (if-rv-fix,6.08 KB, patch)
2017-04-05 22:46 UTC, christos kotsis
Details | Diff
UPDATED:Fixed the issue with REPLACING_VERSIONS (patch,1019 bytes, patch)
2017-04-05 23:37 UTC, christos kotsis
Details | Diff
nfs-utils-1.3.1-r5.ebuild.patch (nfs-utils-1.3.1-r5.ebuild.patch,1.31 KB, patch)
2017-04-10 13:31 UTC, christos kotsis
Details | Diff
nfs-utils-1.3.1-r5.ebuild.patch (nfs-utils-1.3.1-r5.ebuild.patch,1.16 KB, patch)
2017-04-10 13:33 UTC, christos kotsis
Details | Diff
nfs-utils-2.1.1.ebuild.patch (nfs-utils-2.1.1.ebuild.patch,1.16 KB, patch)
2017-04-10 13:51 UTC, christos kotsis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-23 12:49:00 UTC
See the tracker bug.

  if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then

This doesn't account for empty RV or having >1 value.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-23 12:49:33 UTC
Plus using < lexicographical string comparison on versions.
Comment 2 christos kotsis 2017-04-05 22:46:59 UTC
Created attachment 469302 [details, diff]
Fixed the issue with REPLACING_VERSIONS regarding the >1.3.0 or none
Comment 3 christos kotsis 2017-04-05 23:02:37 UTC
Comment on attachment 469302 [details, diff]
Fixed the issue with REPLACING_VERSIONS regarding the >1.3.0 or none

--- origi	2017-04-06 01:57:58.036602203 +0300
+++ if-rv-fix	2017-04-06 01:57:49.115602024 +0300
@@ -1,3 +1,4 @@
+
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -159,16 +160,24 @@
 		cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
 	done
 
-	if systemd_is_booted; then
-		if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
+	if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
+		if systemd_is_booted; then
 			ewarn "We have switched to upstream systemd unit files. Since"
 			ewarn "they got renamed, you should probably enable the new ones."
 			ewarn "You can run 'equery files nfs-utils | grep systemd'"
 			ewarn "to know what services you need to enable now."
+		else
+			ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
+			ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
+			ewarn "same runlevel as nfsmount."
 		fi
-	else
-		ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
-		ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
-		ewarn "same runlevel as nfsmount."
 	fi
 }
Comment 4 christos kotsis 2017-04-05 23:07:36 UTC
Comment on attachment 469302 [details, diff]
Fixed the issue with REPLACING_VERSIONS regarding the >1.3.0 or none

--- origi	2017-04-06 01:57:58.036602203 +0300
+++ if-rv-fix	2017-04-06 01:57:49.115602024 +0300
@@ -1,3 +1,4 @@
+
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -159,16 +160,24 @@
 		cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
 	done
 
-	if systemd_is_booted; then
-		if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
+	if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
+		if systemd_is_booted; then
 			ewarn "We have switched to upstream systemd unit files. Since"
 			ewarn "they got renamed, you should probably enable the new ones."
 			ewarn "You can run 'equery files nfs-utils | grep systemd'"
 			ewarn "to know what services you need to enable now."
+		else
+			ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
+			ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
+			ewarn "same runlevel as nfsmount."
 		fi
-	else
-		ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
-		ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
-		ewarn "same runlevel as nfsmount."
 	fi
 }
Comment 5 christos kotsis 2017-04-05 23:37:01 UTC
Created attachment 469306 [details, diff]
UPDATED:Fixed the issue with REPLACING_VERSIONS

This one works.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-06 05:37:30 UTC
Comment on attachment 469306 [details, diff]
UPDATED:Fixed the issue with REPLACING_VERSIONS

This does not solve the issue in question, and please do not hijack bugs with your own issues.
Comment 7 christos kotsis 2017-04-06 11:39:29 UTC
(In reply to Michał Górny from comment #6)
> Comment on attachment 469306 [details, diff] [details, diff]
> UPDATED:Fixed the issue with REPLACING_VERSIONS
> 
> This does not solve the issue in question, and please do not hijack bugs
> with your own issues.

Sorry, I did read it wrong. My Intention was to help.

Best wishes
Comment 8 christos kotsis 2017-04-09 17:58:27 UTC
(In reply to Michał Górny from comment #0)
> See the tracker bug.
> 
>   if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
> 
> This doesn't account for empty RV or having >1 value.

Hello,

I have written the following code, as an attempt to fix the issue here. First I tried to fix it by including get_major_version, get_version_component_range but the code was becoming unnecessary complicated. For that, a solution was to use version_is_at_least, which is more unstable ( by it's description), but gives answer to the problem with fewer lines. The ! version_is_at_least was inspired from a solution you've given to a bug page with related content. In addition to that, I've used ${parameter:-default} to shield the code from not-set / null cases.

# Fixes for ( not set/null or >1 ) REPLACING_VERSIONS

# local var=version
	local version

if systemd_is_booted; then
#  Do at least one check {var:-X} in case of not set / null
   for version in ${REPLACING_VERSIONS:-1}; do
       if ! version_is_at_least 1.3.0 ${version:-1.3.0}; then
#      Prints the following for version <= 1.3.0 or for not set / null case
          ewarn "We have switched to upstream systemd unit files. Since"
          ewarn "they got renamed, you should probably enable the new ones."
          ewarn "You can run 'equery files nfs-utils | grep systemd'"
          ewarn "to know what services you need to enable now."
       else
#      Print print information for >1 version case
          ewarn "We have switched to upstream systemd unit files."
       fi
   done

else
    ewarn "If you use OpenRC, the nfsmount service has been replaced with..."
    ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
    ewarn "same runlevel as nfsmount."
fi
Comment 9 christos kotsis 2017-04-10 13:31:54 UTC
Created attachment 469576 [details, diff]
nfs-utils-1.3.1-r5.ebuild.patch
Comment 10 christos kotsis 2017-04-10 13:33:52 UTC
Created attachment 469578 [details, diff]
nfs-utils-1.3.1-r5.ebuild.patch
Comment 11 christos kotsis 2017-04-10 13:51:35 UTC
Created attachment 469584 [details, diff]
nfs-utils-2.1.1.ebuild.patch

This patch applies to all versions.
Comment 12 Larry the Git Cow gentoo-dev 2019-09-02 07:08:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f9dc630bef434841f8b8a6f9ba6f263a0d1cd70

commit 8f9dc630bef434841f8b8a6f9ba6f263a0d1cd70
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2019-09-02 05:42:22 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2019-09-02 07:08:13 +0000

    net-fs/nfs-utils: Don't assume REPLACING_VERSIONS is singular
    
    Closes: https://bugs.gentoo.org/589488
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 net-fs/nfs-utils/nfs-utils-2.3.3.ebuild | 14 ++++++++------
 net-fs/nfs-utils/nfs-utils-2.3.4.ebuild | 14 ++++++++------
 net-fs/nfs-utils/nfs-utils-2.4.1.ebuild | 14 ++++++++------
 3 files changed, 24 insertions(+), 18 deletions(-)