Skip to content

lib/redmine_git_hosting/commands/sudo.rb: stat broken on FreeBSD #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
craig001 opened this issue Aug 24, 2017 · 5 comments
Closed

lib/redmine_git_hosting/commands/sudo.rb: stat broken on FreeBSD #692

craig001 opened this issue Aug 24, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@craig001
Copy link

craig001 commented Aug 24, 2017

FreeBSD stat does not accept -c arguments...
logs are showing;

root@redmine:/usr/local/www/redmine # cat log/git_hosting.log | grep stat
2017-08-24 18:06:52 +0000 [ERROR] Non-zero exit code pid 87308 exit 1 for `sudo -n -u git -i stat -c %a /git/local/hooks/common/post-receive`
2017-08-24 18:06:53 +0000 [ERROR] Non-zero exit code pid 87320 exit 1 for `sudo -n -u git -i stat -c %a /git/local/hooks/common/post-receive.d/mail_notifications`
2017-08-24 18:06:54 +0000 [ERROR] Non-zero exit code pid 87378 exit 1 for `sudo -n -u git -i stat -c %a /git/local/hooks/common/post-receive.d/git_multimail.py`

root@redmine:/usr/local/www/redmine # sudo -n -u git -i stat -c %a /git/local/hooks/common/post-receive.d/git_multimail.py
stat: illegal option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file|handle ...]
@craig001
Copy link
Author

FreeBSD 11.1 amd64,
redmine 3.4.2
redmine_bootstrap_kit 0.2.5
redmine_git_hosting 1.2.3

@dgeo
Copy link

dgeo commented Jan 5, 2018

This one is fixed by this diff (not a good solution as this breaks linux)

diff --git a/lib/redmine_git_hosting/commands/sudo.rb b/lib/redmine_git_hosting/commands/sudo.rb
index 65448567..72ac5975 100644
--- a/lib/redmine_git_hosting/commands/sudo.rb
+++ b/lib/redmine_git_hosting/commands/sudo.rb
@@ -137,7 +137,7 @@ module RedmineGitHosting
       # Test if file permissions has changed
       #
       def sudo_file_perms_changed?(filemode, dest_file)
-        current_mode = sudo_capture('stat', '-c', "%a", dest_file)
+        current_mode = sudo_capture('stat', '-f', "%Mp%Lp", dest_file)
         current_mode.chomp != filemode
       rescue RedmineGitHosting::Error::GitoliteCommandException => e
         logger.error(e.output)

@n-rodriguez n-rodriguez self-assigned this Jan 5, 2018
@n-rodriguez n-rodriguez added the bug label Jan 5, 2018
@dgeo
Copy link

dgeo commented Jan 5, 2018

the problem may be the same on macos and other *BSD … (tested on OpenBSD)

@n-rodriguez n-rodriguez added this to the v1.2.4 milestone Jan 5, 2018
@n-rodriguez
Copy link
Contributor

the problem may be the same on macos and other *BSD … (tested on OpenBSD)

Thanks for your feedback!

@PowerKiKi
Copy link
Collaborator

As discussed in #732 (comment), issues related to Redmine < 4.0 or severely outdated issues are being closed to help clean up the issue tracker.

If this issue is still relevant to you and you are running Redmine >= 4.0, please open a new issue including all new relevant information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants