dch --create always launches editor

Bug #220733 reported by Steve Magoun
4
Affects Status Importance Assigned to Milestone
devscripts (Debian)
Fix Released
Unknown
devscripts (Ubuntu)
Fix Released
Wishlist
Martin Pitt

Bug Description

Binary package hint: devscripts

I expected 'dch --create "changelog entry"' to run in batch mode. Instead, it created a changelog in interactive mode and opened it in my editor.

The dch man page says this:
"If the text of the change is given on the command line, debchange will run in batch mode and simply add the text, with line breaks as necessary, at the appropriate place in debian/changelog (or the changelog specified by options, as described below)."

Since I provided the text of the change, I expected dch to run in batch mode.

I can reproduce this on Gutsy (devscripts 2.10.7ubuntu5mbu1) and Hardy (devscripts 2.10.11ubuntu5).

Tags: oem-services

Related branches

Revision history for this message
Steve Magoun (smagoun) wrote :

s/mbu1//, oops.

Daniel Hahler (blueyed)
Changed in devscripts:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Daniel Holbach (dholbach) wrote :

Martin: can you please take a look at it?

Martin Pitt (pitti)
Changed in devscripts:
assignee: nobody → pitti
status: Triaged → In Progress
Revision history for this message
Adam D. Barratt (adam-barratt) wrote :

fwiw, this appears to be intentional.

--create support was added upstream in 2.9.5. The diff between the relevant SVN revisions of the time includes:

# Now Run the Editor; always run if doing "closes" to give a chance to check
-if (! $TEXT or @closes_text) {
+if (! $TEXT or @closes_text or $opt_create) {

Revision history for this message
Adam D. Barratt (adam-barratt) wrote :

Also fwiw, the debdiff includes two changes but the changelog entry only mentions one of them (the other being suppressing the "initial release" entry if text was passed on the command line)

Revision history for this message
Steve Magoun (smagoun) wrote :

Both changes are necessary to suppress the editor. I've updated the changelog entry to say the patch suppresses the "initial release" line when dch --create is given a changelog entry - thanks!

Though the code currently in debchange appears to be intentional it is not correct and doesn't behave as documented:

The "initial release" text is assigned to @closes_text, and currently the script launches the editor if @closes_text is populated. For this reason the ' or $opt_create' test for launching the editor is a NOOP - in the current code @closes_text is always populated if $opt_create is true.

If @closes_text were *not* set (which my patch allows) then the test for $opt_create would affect control flow. However, the test for $opt_create is still no good - my patch to prevent @closes_text from being populated requires that $opt_create be true and $TEXT be populated. This means testing for $opt_create is going to launch the editor even though the user passed in text on the command line. Passing text on the cmd line is documented to *not* open the editor but instead run in batch mode. Therefore the test for $opt_create needs to be removed.

Given that the documentation says that text passed on the cmd line is "simply add[ed]" to the changelog I think it is reasonable to remove the "initial release" text in this case.

Revision history for this message
Steve Magoun (smagoun) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

The patch is at least incomplete. In order to get a valid changelog, you need to specify at least --package and -v in addition to the text in --create mode. The current patch does not enforce this.

Can you please file a Debian bug for this and discuss the approach there? I'd really like to avoid introducing such incompatibilities between Debian and Ubuntu, especially for tools which are called noninteractively from scripts.

Changed in devscripts:
status: In Progress → Incomplete
assignee: pitti → nobody
Revision history for this message
Steve Magoun (smagoun) wrote :

Updated patch to required --package and -v for batch mode.

Filed debian bug 484334 with the same patch.

Revision history for this message
Martin Pitt (pitti) wrote :

That looks much better now, thank you! Let's see what the Debian maintainer says, but I don't see a reason to reject the patch any more.

Changed in devscripts:
assignee: nobody → pitti
status: Incomplete → In Progress
Changed in devscripts:
status: Unknown → New
Changed in devscripts:
status: New → Fix Committed
Revision history for this message
Adam D. Barratt (adam-barratt) wrote :

I've applied a variation on Steve's patch to what will be 2.10.30

The Debian bug contains a copy of the final diff and a brief description of my changes and the reasoning behind them

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks a lot, Adam!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devscripts - 2.10.26ubuntu6

---------------
devscripts (2.10.26ubuntu6) intrepid; urgency=low

  * debchange:
    + Don't automatically open an editor when creating a new changelog if
      a package name and version are supplied and either --empty was used
      or the text of a changelog entry was supplied on the command line.
      Based on a patch from Steve Magoun (Closes: #4843334, LP: #220733)
    + Don't automatically add an "initial release" stanza to a newly created
      changelog if the text of a changelog entry was supplied on the command
      line. Thanks Steve Magoun.
    (Backported from Debian SVN)

 -- Martin Pitt <email address hidden> Mon, 09 Jun 2008 08:34:42 +0000

Changed in devscripts:
status: In Progress → Fix Released
Changed in devscripts:
status: Fix Committed → Fix Released
Michael Terry (mterry)
tags: added: oem-services
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.