Skip to content
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

Fix error with zsh when NOCLOBBER is enabled #734

Merged
merged 1 commit into from
Apr 21, 2015

Conversation

bchretien
Copy link
Contributor

The following option is available in zsh:

NOCLOBBER prevents you from accidentally overwriting an existing file.

% setopt noclobber
% cat /dev/null >~/.zshrc
zsh: file exists: /u/pfalstad/.zshrc

(cf. zsh documentation)

This option is not enabled by default, but when it is, sourcing setup.[z]sh fails with:

.../catkin_ws/devel/setup.sh:52: file exists: /tmp/setup.sh.ixlgRQcPyh
Failed to run '".../catkin_ws/devel/_setup_util.py" ': return code 1

This is caused by this line. >> could be used instead since the file was just created and is empty. That way, noclobber does not need to be disabled, and zsh users with these crazy options are happy.

According to the zsh documentation, NOCLOBBER prevents you from
accidentally overwriting an existing file:

% setopt noclobber
% cat /dev/null >~/.zshrc
zsh: file exists: /u/pfalstad/.zshrc

Since the temporary file was just created, we can just append to
it, and noclobber does not need to be disabled.
@wjwwood
Copy link
Member

wjwwood commented Apr 21, 2015

_SETUP_TMP should always be unique, so looks ok to me.

dirk-thomas added a commit that referenced this pull request Apr 21, 2015
Fix error with zsh when NOCLOBBER is enabled
@dirk-thomas dirk-thomas merged commit 371bd83 into ros:indigo-devel Apr 21, 2015
@dirk-thomas
Copy link
Member

Thanks for the patch.

@bchretien
Copy link
Contributor Author

Thanks for the quick review and merge 👍

cwecht pushed a commit to cwecht/catkin that referenced this pull request Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants