#480 Add /home to banned directories
Opened a year ago by thebeanogamer. Modified 4 months ago
thebeanogamer/FedoraReview bannedhome  into  master

file modified
+5 -3
@@ -1,8 +1,8 @@ 

  #!/bin/bash

  # @group: Generic

  # @name: generic-srv-opt

- # @url: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_documentation

- # @text: Packages must not store files under /srv, /opt or /usr/local

+ # @url: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_no_files_or_directories_under_srv_usrlocal_or_homeuser

+ # @text: Packages must not store files under /srv, /opt, /usr/local, /home

  # @type: MUST

  

  if unpack_rpms; then
@@ -12,15 +12,17 @@ 

          [ -d "$rpm/opt" ] && opt_rpms=( $rpm ${opt_rpms[@]} )

          [ -d "$rpm/srv" ] && srv_rpms=( $rpm ${srv_rpms[@]} )

          [ -d "$rpm/usr/local" ] && local_rpms=( $rpm ${local_rpms[@]} )

+         [ -d "$rpm/home" ] && home_rpms=( $rpm ${home_rpms[@]} )

      done

  

-     test -z "${opt_rpms[*]}${srv_rpms[*]}${local_rpms[*]}" && \

+     test -z "${opt_rpms[*]}${srv_rpms[*]}${local_rpms[*]}${home_rpms[*]}" && \

          exit $FR_PASS

  

      echo "Rpm(s) have files under /srv, /opt or /usr/local:"

      for rpm in ${opt_rpms[@]};   do echo "    /opt       $rpm"; done

      for rpm in ${srv_rpms[@]};   do echo "    /srv       $rpm"; done

      for rpm in ${local_rpms[@]}; do echo "    /usr/local $rpm"; done

+     for rpm in ${home_rpms[@]};  do echo "    /home      $rpm"; done

      exit $FR_FAIL

  else

      echo "Cannot unpack rpms (using --prebuilt?)"

file modified
+2 -1
@@ -111,7 +111,7 @@ 

          self.assertEqual(9, a2.order_hint)

  

      def test_srv_opt(self):

-         """Test check of no files in /srv, /opt and /usr/local."""

+         """Test check of no files in /srv, /opt, /usr/local, and /home."""

          self.init_test("srv-opt", argv=["-rn", "dummy", "--cache", "--no-build"])

          os.chdir("..")

          bug = NameBug("dummy")
@@ -125,6 +125,7 @@ 

          self.assertTrue("/srv" in check.result.output_extra)

          self.assertTrue("/opt" in check.result.output_extra)

          self.assertTrue("/usr/local" in check.result.output_extra)

+         self.assertTrue("/home" in check.result.output_extra)

  

  

  if __name__ == "__main__":

I've updated the banned directory check to also include /home. Whilst I have updated the actual test to validate that this is working, I'm unsure of the best way to update the RPM that's being tested. I'd appreciate some guidance on this please, as currently the test does not pass on this branch.

rebased onto 203ffb21b19b5fb39d81d725d695d9b434534f9b

a year ago

rebased onto 46fd720

a year ago

rebased onto d8e4bb0

4 months ago