'bzr shelve' in an emacs shell buffer requires a non buffered input

Bug #459185 reported by Barry Warsaw
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Wishlist
Unassigned

Bug Description

bzr 2.0.1 on karmic
emacs 23.1.50.1 (emacs-snapshot)

'bzr shelve --all' works just fine in an emacs shell buffer, but neither 'bzr shelve' itself or 'bzr shelve somefile' works.

In both latter cases, bzr issues prompts, one for the diff hunks that are being shelved, and a final confirmation for all the shelved changes. In a gnome-terminal, this works perfectly, but in an emacs buffer, you never get the final confirmation prompt. It simply exits and the change is never shelved:

% bzr shelve lib/canonical/launchpad/daemons/tachandler.py
...
Shelve? [yNfq?]y
Selected changes:
 M lib/canonical/launchpad/daemons/tachandler.py
% bzr shelve --list
No shelved changes.

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 459185] [NEW] 'bzr shelve' with confirmation fails in an emacs shell buffer

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry Warsaw wrote:
> Public bug reported:
>
> bzr 2.0.1 on karmic
> emacs 23.1.50.1 (emacs-snapshot)
>
> 'bzr shelve --all' works just fine in an emacs shell buffer, but neither
> 'bzr shelve' itself or 'bzr shelve somefile' works.
>
> In both latter cases, bzr issues prompts, one for the diff hunks that
> are being shelved, and a final confirmation for all the shelved changes.
> In a gnome-terminal, this works perfectly, but in an emacs buffer, you
> never get the final confirmation prompt. It simply exits and the change
> is never shelved:
>
> % bzr shelve lib/canonical/launchpad/daemons/tachandler.py
> ...
> Shelve? [yNfq?]y
> Selected changes:
> M lib/canonical/launchpad/daemons/tachandler.py
> % bzr shelve --list
> No shelved changes.

My guess is that it is something to do with 'getchar' buffering. ISTR
that shelve1 also required using a specific TERM in emacs.

Basically, shelve is trying to respond to a single character input "y"
and not "y<enter>". However the way emacs buffers the terminal, it can
*only* supply "y<enter>". As such, the <enter> remains in our stdin
buffer, and is consumed by the final prompt.

Can you try entering "yyyyyy<enter>" in emacs and seeing if that
properly shelves things? (it should buffer all the y's which we will
consume in a row.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrh1N0ACgkQJdeBCYSNAAOsYACeP/JmDQBcnpzmFO3Auk4Uj25J
AXQAoMtzTcXKJdK1nr/bCGXiATiNn0VE
=Cm16
-----END PGP SIGNATURE-----

Vincent Ladeuil (vila)
summary: - 'bzr shelve' with confirmation fails in an emacs shell buffer
+ 'bzr shelve' in an emacs shell buffer requires a non buffered input
Revision history for this message
Vincent Ladeuil (vila) wrote :

John is right on all points but one: it's not a specific TERM that is needed but a specific mode.
Namely, shelve works right in an eshell buffer but can't work in regular shell buffer.

Fixing that is not trivial but there is little incentive to do so because 'bzr shelve --all' is
nearly all that is not covered by a judicious combination of diff-mode
 (in a buffer containing the output of 'bzr dif' ) and 'bzr revert' and
'bzr shelve --all' works fine in all shell buffers.

Changed in bzr:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 459185] Re: 'bzr shelve' in an emacs shell buffer requires a non buffered input

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> John is right on all points but one: it's not a specific TERM that is needed but a specific mode.
> Namely, shelve works right in an eshell buffer but can't work in regular shell buffer.
>
> Fixing that is not trivial but there is little incentive to do so because 'bzr shelve --all' is
> nearly all that is not covered by a judicious combination of diff-mode
> (in a buffer containing the output of 'bzr dif' ) and 'bzr revert' and
> 'bzr shelve --all' works fine in all shell buffers.
>
>
> ** Changed in: bzr
> Importance: Undecided => Wishlist
>
> ** Changed in: bzr
> Status: New => Confirmed
>

What if we just added a flag like:
 "--input-uses-enter"

Which would tell our interactive processes that they should expect
"y<enter>" rather than just "y".

It would seem to be a reasonable tradeoff. As we add more commands that
end up being interactive, this is going to come up more often.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrlrgEACgkQJdeBCYSNAAOKrwCgu4eYtMl4hq566X9HbQEdrHw/
bhoAoKsAAFW9Gp+LzO2UQJWVp+jOP4vI
=/g7/
-----END PGP SIGNATURE-----

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.