Shellsink crashes if .bash_history_timestamp is empty

Bug #329222 reported by Luca Invernizzi
2
Affects Status Importance Assigned to Milestone
shellsink
Fix Committed
Undecided
Unassigned

Bug Description

Hello,
    shellsink crashes if ${HOME}/.bash_history_timestamp is empty.

Traceback of the issue (after removing the content of .bash_history_timestamp):
 File "/usr/bin/shellsink-client", line 222, in <module>
    main()
  File "/usr/bin/shellsink-client", line 219, in main
    client.send_command()
  File "/usr/bin/shellsink-client", line 56, in send_command
    if self.has_new_command():
  File "/usr/bin/shellsink-client", line 87, in has_new_command
    last_recorded_history_timestamp = self.last_recorded_history_timestamp()
  File "/usr/bin/shellsink-client", line 100, in last_recorded_history_timestamp
    old_history_timestamp = float(file.readline())
ValueError: empty string for float()

Removing that file fixes the issue.

The bug appears to be in line 98 of /usr/bin/shellsink-client.

Patch:
Change line 98 of /usr/bin/shellsink-client from:
    if os.path.exists(self.history_timestamp):
to
    if os.path.exists(self.history_timestamp) and os.path.getsize(self.history_timestamp)>0 :

fixes the bug.

Regards,
  Luca Invernizzi

Revision history for this message
Joshua Cronemeyer (joshuacronemeyer) wrote :

Thanks for the bug report. Revision 36 fixes this. I actually changed it so it should handle any corruption of the history timestamp file, not just a truncated file. The new fix also requires less code and no if statements, so that is good too. I'm considering pushing out a new version of the client to the debian repository this weekend. Expect to see this change in there. Or you can always just use what is in trunk.

Changed in shellsink:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.