empty arguments lost in EDITOR

Bug #1089792 reported by Ross Lagerwall on 2012-12-13
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
High
Ross Lagerwall
2.5
High
Ross Lagerwall

Bug Description

I have my EDITOR='emacsclient -a "" -t'.

When it comes to commit, bzr does not invoke the editor correctly. It invokes it as 'emacsclient -a "-t"'.

To reproduce this, first create a simple script which shows the arguments given to it:
$ cat - > /tmp/args
#!/usr/bin/python2

import sys

for i in sys.argv:
    print "'%s'" % i
EOF

$ chmod +x /tmp/args
$ export EDITOR='/tmp/args -a "" -t'
$ bzr commit
Committing to: /tmp/repo/
...
'/tmp/args'
'-a'
'-t'
'/tmp/bzr_log.O8navN'

You can see that the arguments are incorrect, it should be something like:
Committing to: /tmp/repo/
...
'/tmp/args'
'-a'
''
'-t'
'/tmp/bzr_log.O8navN'

Related branches

Richard Wilbur (richard-wilbur) wrote :

Which version of bzr are you running? Here's what I get when I try the test case:
rwilbur@ordinate:~/src/bzr_test$ bzr status
added:
  args
rwilbur@ordinate:~/src/bzr_test$ export EDITOR='/home/rwilbur/src/bzr_test/args -a "" -t'
rwilbur@ordinate:~/src/bzr_test$ printf "%s\n" $EDITOR
/home/rwilbur/src/bzr_test/args
-a
""
-t
rwilbur@ordinate:~/src/bzr_test$ bzr commit
Committing to: /home/rwilbur/src/bzr_test/
added args
'/home/rwilbur/src/bzr_test/args'
'-a'
'""'
'-t'
'bzr_log.8Edb8D'
aborting commit write group: BzrCommandError(empty commit message specified)
bzr: ERROR: empty commit message specified
rwilbur@ordinate:~/src/bzr_test$ bzr --version
Bazaar (bzr) 2.1.4

$ bzr --version
Bazaar (bzr) 2.5.1
  Python interpreter: /usr/bin/python2 2.7.3
  Python standard library: /usr/lib/python2.7
  Platform: Linux-3.6.9-1-ARCH-x86_64-with-glibc2.2.5
  bzrlib: /usr/lib/python2.7/site-packages/bzrlib
  Bazaar configuration: /home/ross/.config/bazaar
  Bazaar log file: /home/ross/.bzr.log

Copyright 2005-2012 Canonical Ltd.
http://bazaar.canonical.com/

bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Bazaar is part of the GNU Project to produce a free operating system.

---
Perhaps this bug was introduced since then?

I think:
 1. You're right, it looks like a regression somewhere between 2.1.4 and 2.5.1! Good catch.
 2. Maybe I need to update my dusty bzr install on this machine. Of course it is running Ubuntu 10.04 LTS (which is still supported till April 2013).

I guess I need to jump on a machine with a newer version of bzr so I can reproduce this bug. (Tomorrow)

Richard Wilbur (richard-wilbur) wrote :

Reproduced on my Ubuntu 12.04 LTS install which provides bzr 2.5.1.

Changed in bzr:
status: New → Confirmed
milestone: none → 2.5.2
milestone: 2.5.2 → 2.6b3
importance: Undecided → High
status: Confirmed → Triaged
Richard Wilbur (richard-wilbur) wrote :

Seems we should target this fix to HEAD and 2.5.2, at least, since you discovered it in 2.5.1. I tried to select two milestones as targets and I'm not sure what became of that.

Ross do you want this bug assigned to you since you created the fix?

Changed in bzr:
assignee: nobody → Ross Lagerwall (rosslagerwall)
Richard Wilbur (richard-wilbur) wrote :

Looks like the regression was introduced between 2.2.4 and 2.5.1, which narrows the field slightly.

Tested with the following results on bzr 2.2.4 under Ubuntu 10.10 (seems to work correctly):

rwilbur@conjugate:/tmp/repo$ export EDITOR='/tmp/repo/args -a "" -t'
rwilbur@conjugate:/tmp/repo$ bzr commit
Committing to: /tmp/repo/
added args
'/tmp/repo/args'
'-a'
'""'
'-t'
'bzr_log.TJb3jF'
Commit message was not edited, use anyway? [y/n]: n
aborting commit write group: BzrCommandError(empty commit message specified)
bzr: ERROR: empty commit message specified
rwilbur@conjugate:/tmp/repo$ bzr --version
Bazaar (bzr) 2.2.4
  Python interpreter: /usr/bin/python 2.6.6
  Python standard library: /usr/lib/python2.6
  Platform: Linux-2.6.35-32-generic-x86_64-with-Ubuntu-10.10-maverick
  bzrlib: /usr/lib/python2.6/dist-packages/bzrlib
  Bazaar configuration: /home/rwilbur/.bazaar
  Bazaar log file: /home/rwilbur/.bzr.log

Copyright 2005-2010 Canonical Ltd.
http://bazaar.canonical.com/

Vincent Ladeuil (vila) on 2013-05-25
summary: - bzr invokes incorrect command
+ empty arguments lost in EDITOR
Vincent Ladeuil (vila) on 2013-05-27
Changed in bzr:
status: Triaged → Fix Released
Vincent Ladeuil (vila) on 2013-07-27
Changed in bzr:
milestone: 2.6b3 → 2.6.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers