Bug #29326

./flow3 core:setfilepermissions should not rely on sudo without proper test

Added by Steffen Müller almost 4 years ago. Updated over 2 years ago.

Status:Resolved Start date:2011-08-29
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:Command
Target version:TYPO3 Flow Base Distribution - 1.0 beta 2
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

./flow3 core:setfilepermissions calls sudo without a proper test if it is installed and correctly setup.
On systems without sudo this leads to gazillions of ugly failing sudo calls within the find loop.

This can be reproduced on standard debian installation which is shipped without sudo.

I suggest not to rely on sudo at all, but prompt the user for running ./flow3 core:setfilepermissions as root or with sudo himself.

Associated revisions

Revision f7cc2c88
Added by Robert Lemke almost 4 years ago

[BUGFIX] setfilepermissions does not use sudo anymore

This changes the behavior of the setfilerpermissions
command. Instead of using sudo right away, the bash
script now checks if it is run as root and if not
displays a message that it should.

Change-Id: Ied6dae7d4a78909442ac5087767267214f6ebc12
Resolves: #29326

History

#1 Updated by Karsten Dambekalns almost 4 years ago

  • Category set to Command
  • Target version set to 1.0 beta 2

Wow, a vanilla Ubuntu setup doesn't have sudo? I'm surprised, never seen a system without it... :)

#2 Updated by Christian Müller almost 4 years ago

No idea about current Debian but I am pretty sure Ubuntu still has sudo, they usually rely on it as they don't allow su by default.

#3 Updated by Steffen Müller almost 4 years ago

Ubuntu ships sudo when using default installer. Debian (aka ubuntu vanilla) does not. Those .deb based systems which have been setup with dbootstrap do not neccessarily have sudo. And Ubuntu users could have uninstalled sudo.

However, the main point is: shell scripts should always test for third party tools (maybe with one exception for gnutools).

But in case of sudo, I would never use sudo wraps in shell scripts:

"The thing is that the best decision is always the one that gives control to the user, so that he decides to run your script as root or not by making him write "sudo" or not..."
http://ubuntuforums.org/archive/index.php/t-1497966.html

So please just remove sudo calls from the script. Instead, add a check if the user has root permissions and exit with a notice if not.

#4 Updated by Mr. Hudson almost 4 years ago

  • Status changed from New to Under Review

Patch set 1 of change Ied6dae7d4a78909442ac5087767267214f6ebc12 has been pushed to the review server.
It is available at http://review.typo3.org/4871

#5 Updated by Steffen Müller almost 4 years ago

Thanks for taking care.
Could be please also remove sudo call from the script?

#6 Updated by Robert Lemke almost 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Steffen Müller almost 4 years ago

Problem is still not fixed.

#8 Updated by Christian Nölle over 2 years ago

Well, just tried to kickstart a new FLOW installation based on 1.1.0, problem still occurs. Furthermore there is no documentation on how to set up permissions by hand.

#9 Updated by Ottmar Biebersdorf over 2 years ago

Can confirm this issue on Debian Squeeze using the current master (15.02.2013). Running the script as root produces lots of errors "sudo not found". After installing sudo the script is running fine without errormessage.

Also available in: Atom PDF