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

abrt-console-notification.sh error if noclobber is set: abrt/lastnotification.<TMP_SUFFIX>: cannot overwrite existing file #1371

Closed
ScottABrown opened this issue Mar 27, 2019 · 2 comments · Fixed by #1498

Comments

@ScottABrown
Copy link

This in abrt/src/cli/abrt-console-notification.sh:

    date +%s > "$TMPPATH" 2>"$ABRT_DEBUG_LOG"

fails if noclobber has been set. If $TMPPATH points to a file to be replaced, it should be removed explicitly first.

@jfilak
Copy link
Contributor

jfilak commented Mar 27, 2019

D'oh, did it print out the error message to your terminal? (I tried so hard to mute all errors).

The command should create a file holding the date of the last notification. The script tries to robust, so it first creates a temporary file and if it succeeds, it adds the content.

The failing command can be replaced with date +%s >> to get rid of the failure - I hope there is no option preventing commands from appending files :)

The redirects should be swapped to avoid errors being printed out - i.e. first 2>"$ABRT_DEBUG_LOG" > "$TMPPATH" - the goal was quietly fail even if this is a valid bug.

@xsuchy xsuchy added this to Needs triage in Issue review via automation Apr 9, 2020
@xsuchy xsuchy moved this from Needs triage to Yes in Issue review Apr 9, 2020
@xsuchy
Copy link
Member

xsuchy commented Apr 22, 2020

ernestask added a commit that referenced this issue Jun 8, 2020
If the goal is to prevent any kind of error leakage to the user, then
stderr redirection must come first.

#1371
ernestask added a commit that referenced this issue Jun 8, 2020
When using bash and when noclobber is set on the parent shell, trying to
write out the current time will fail every time. We can instead append
to the file and read the last line instead, in case moving fails as
well.

Fixes #1371
Issue review automation moved this from Yes to Done Jun 8, 2020
mgrabovsky pushed a commit that referenced this issue Jun 8, 2020
If the goal is to prevent any kind of error leakage to the user, then
stderr redirection must come first.

#1371
mgrabovsky pushed a commit that referenced this issue Jun 8, 2020
When using bash and when noclobber is set on the parent shell, trying to
write out the current time will fail every time. We can instead append
to the file and read the last line instead, in case moving fails as
well.

Fixes #1371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Issue review
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants