#741 closed defect (fixed)

tahoe create-alias corrupts the aliases file if it does not have a trailing newline

Reported by: kpreid Owned by: davidsarah
Priority: major Milestone: 1.6.0
Component: code-frontend-cli Version: 1.4.1
Keywords: alias easy Cc: kpreid
Launchpad Bug:

Description

tahoe create-alias apparently just appends "foo: bar\n" to the aliases file. This will corrupt the alias file if it does not already end in "\n".

Change History (7)

comment:1 Changed at 2009-06-19T21:49:41Z by kpreid

  • Cc kpreid added

comment:2 Changed at 2009-12-06T17:42:46Z by davidsarah

  • Keywords alias easy added
  • Milestone changed from undecided to 1.6.0

comment:3 Changed at 2009-12-30T01:10:30Z by davidsarah

  • Owner set to davidsarah

comment:4 Changed at 2010-01-14T00:21:30Z by davidsarah

  • Milestone changed from 1.6.0 to eventually

Dropping this for 1.6.0.

comment:5 Changed at 2010-01-14T21:10:34Z by warner

  • Milestone changed from eventually to 1.6.0
  • Resolution set to fixed
  • Status changed from new to closed

Apparently I'm procrastinating. Fixed in 874a979a8ec2b167.

comment:6 Changed at 2010-01-14T23:37:00Z by davidsarah

Looks good. I suggest factoring the common code between add_alias and create_alias in source:src/allmydata/scripts/tahoe_add_alias.py , though.

Are blank lines in the alias file ignored? If the file is initially empty then not aliases.endswith("\n") will be true and an initial blank line will be written.

comment:7 Changed at 2010-01-15T06:48:06Z by warner

Agreed. Pushed in bb4883bbd4a1a2dc.

Yes, blank lines are ignored: source:src/allmydata/scripts/common.py#L106 (in get_aliases). So I'm not too worried about existing-but-empty files. That should happen even less frequently than manually-edited-and-accidentally-corrupted files :-).

Note: See TracTickets for help on using tickets.