URL: https://github.com/freeipa/freeipa/pull/3025 Author: frozencemetery Title: #3025: Fix unnecessary usrmerge assumptions Action: opened
PR body: """ On non-usrmerge systems (e.g., Debian), bash, mv, cp, cat, tail, keyctl, and gzip live in /bin, not /usr/bin. On usrmerge systems, /bin is a symlink to /usr/bin (or vice versa), so this has no effect. Signed-off-by: Robbie Harwood <rharw...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/3025/head:pr3025 git checkout pr3025
From 63657430e83913c8f68569e5b9c38def3fd5ce95 Mon Sep 17 00:00:00 2001 From: Robbie Harwood <rharw...@redhat.com> Date: Wed, 10 Apr 2019 17:25:37 -0400 Subject: [PATCH] Fix unnecessary usrmerge assumptions On non-usrmerge systems (e.g., Debian), bash, mv, cp, cat, tail, keyctl, and gzip live in /bin, not /usr/bin. On usrmerge systems, /bin is a symlink to /usr/bin (or vice versa), so this has no effect. Signed-off-by: Robbie Harwood <rharw...@redhat.com> --- ipaplatform/base/paths.py | 4 ++-- ipatests/test_integration/test_installation.py | 4 ++-- ipatests/test_integration/test_replica_promotion.py | 4 ++-- ipatests/test_integration/test_sudo.py | 12 ++++++------ ipatests/test_integration/test_uninstallation.py | 4 ++-- ipatests/test_ipalib/test_util.py | 4 ++-- makerpms.sh | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py index 42b8558246..a7c6b6ecc6 100644 --- a/ipaplatform/base/paths.py +++ b/ipaplatform/base/paths.py @@ -26,7 +26,7 @@ class BasePathNamespace: BASH = "/bin/bash" BIN_HOSTNAMECTL = "/bin/hostnamectl" ECHO = "/bin/echo" - GZIP = "/usr/bin/gzip" + GZIP = "/bin/gzip" LS = "/bin/ls" SH = "/bin/sh" SYSTEMCTL = "/bin/systemctl" @@ -390,7 +390,7 @@ class BasePathNamespace: BAK2DB = '/usr/sbin/bak2db' DB2BAK = '/usr/sbin/db2bak' IPA_SERVER_UPGRADE = '/usr/sbin/ipa-server-upgrade' - KEYCTL = '/usr/bin/keyctl' + KEYCTL = '/bin/keyctl' GETENT = '/usr/bin/getent' SSHD = '/usr/sbin/sshd' SSSCTL = '/usr/sbin/sssctl' diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index 3f399362ec..56cb74d9a3 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -29,7 +29,7 @@ def create_broken_resolv_conf(master): # Force a broken resolv.conf to simulate a bad response to # reverse zone lookups master.run_command([ - '/usr/bin/mv', + '/bin/mv', paths.RESOLV_CONF, '%s.sav' % paths.RESOLV_CONF ]) @@ -41,7 +41,7 @@ def create_broken_resolv_conf(master): def restore_resolv_conf(master): if os.path.exists('%s.sav' % paths.RESOLV_CONF): master.run_command([ - '/usr/bin/mv', + '/bin/mv', '%s.sav' % paths.RESOLV_CONF, paths.RESOLV_CONF ]) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 460dbb706a..68240eb592 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -635,7 +635,7 @@ def update_etc_hosts(host, ip, old_hostname, new_hostname): :param new_hostname the new hostname to put in /etc/hosts ''' # Make a backup - host.run_command(['/usr/bin/cp', + host.run_command(['/bin/cp', paths.HOSTS, '%s.sav' % paths.HOSTS]) contents = host.get_file_contents(paths.HOSTS, encoding='utf-8') @@ -655,7 +655,7 @@ def update_etc_hosts(host, ip, old_hostname, new_hostname): def restore_etc_hosts(host): '''Restores /etc/hosts.sav into /etc/hosts ''' - host.run_command(['/usr/bin/mv', + host.run_command(['/bin/mv', '%s.sav' % paths.HOSTS, paths.HOSTS], raiseonerr=False) diff --git a/ipatests/test_integration/test_sudo.py b/ipatests/test_integration/test_sudo.py index 497e54dba6..661e22f3c3 100644 --- a/ipatests/test_integration/test_sudo.py +++ b/ipatests/test_integration/test_sudo.py @@ -156,8 +156,8 @@ def test_nisdomainname(self): def test_add_sudo_commands(self): # Group: Readers - self.master.run_command(['ipa', 'sudocmd-add', '/usr/bin/cat']) - self.master.run_command(['ipa', 'sudocmd-add', '/usr/bin/tail']) + self.master.run_command(['ipa', 'sudocmd-add', '/bin/cat']) + self.master.run_command(['ipa', 'sudocmd-add', '/bin/tail']) # No group self.master.run_command(['ipa', 'sudocmd-add', '/usr/bin/yum']) @@ -167,10 +167,10 @@ def test_add_sudo_command_groups(self): '--desc', '"Applications that read"']) self.master.run_command(['ipa', 'sudocmdgroup-add-member', 'readers', - '--sudocmds', '/usr/bin/cat']) + '--sudocmds', '/bin/cat']) self.master.run_command(['ipa', 'sudocmdgroup-add-member', 'readers', - '--sudocmds', '/usr/bin/tail']) + '--sudocmds', '/bin/tail']) def test_create_allow_all_rule(self): # Create rule that allows everything @@ -441,8 +441,8 @@ def test_sudo_rule_restricted_to_command_and_command_group(self): result1 = self.list_sudo_commands("testuser1") assert "(ALL : ALL) NOPASSWD:" in result1.stdout_text assert "/usr/bin/yum" in result1.stdout_text - assert "/usr/bin/tail" in result1.stdout_text - assert "/usr/bin/cat" in result1.stdout_text + assert "/bin/tail" in result1.stdout_text + assert "/bin/cat" in result1.stdout_text def test_setting_category_to_all_with_valid_entries_command(self): result = self.reset_rule_categories(safe_delete=False) diff --git a/ipatests/test_integration/test_uninstallation.py b/ipatests/test_integration/test_uninstallation.py index d66d52b7bd..9d8cb1cc0a 100644 --- a/ipatests/test_integration/test_uninstallation.py +++ b/ipatests/test_integration/test_uninstallation.py @@ -72,7 +72,7 @@ def test_failed_uninstall(self): # uninstaller to raise an exception and return with a # non-zero return code. self.master.run_command([ - '/usr/bin/mv', + '/bin/mv', '%s/%s' % (paths.ETC_DIRSRV, instance_name), '%s/%s.test' % (paths.ETC_DIRSRV, instance_name) ]) @@ -95,7 +95,7 @@ def test_failed_uninstall(self): # Moving it back should allow the uninstall to finish # successfully. self.master.run_command([ - '/usr/bin/mv', + '/bin/mv', '%s/%s.test' % (paths.ETC_DIRSRV, instance_name), '%s/%s' % (paths.ETC_DIRSRV, instance_name) ]) diff --git a/ipatests/test_ipalib/test_util.py b/ipatests/test_ipalib/test_util.py index 9e755d7e4c..38d37a51f5 100644 --- a/ipatests/test_ipalib/test_util.py +++ b/ipatests/test_ipalib/test_util.py @@ -14,8 +14,8 @@ @pytest.mark.parametrize('pager,expected_result', [ # Valid values - ('cat', '/usr/bin/cat'), - ('/usr/bin/cat', '/usr/bin/cat'), + ('cat', '/bin/cat'), + ('/bin/cat', '/bin/cat'), # Invalid values (wrong command, package is not installed, etc) ('cat_', None), ('', None) diff --git a/makerpms.sh b/makerpms.sh index a701d367f3..f2a1a496dc 100755 --- a/makerpms.sh +++ b/makerpms.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash set -o errexit pushd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org