darcs

Issue 2187 apply: hIsTerminalDevice: illegal operation (handle is closed)

Title apply: hIsTerminalDevice: illegal operation (handle is closed)
Priority bug Status needs-diagnosis/design
Milestone Resolved in
Superseder refactor Darcs.Test and Darcs.Repository.Internal.testAny
View: 2198
Nosy List ilya
Assigned To
Topics

Created on 2012-04-27.23:26:09 by ilya, last changed 2012-05-29.19:14:09 by ilya.

Files
File name Uploaded Type Edit Remove
unnamed bsrkaditya, 2012-04-28.05:55:34 text/html
Messages
msg15625 (view) Author: ilya Date: 2012-04-27.23:26:08
"apply" should not ask anything if it is reading patches from stdin.

"darcs apply --test <patch-set" crashes if the test fails, because it
attempts to ask "Shall I apply them anyway? [yN]":
Running test...

Test failed!

Looks like those patches do not pass the tests.
darcs-2.8.0: <stdin>: hIsTerminalDevice: illegal operation (handle is
closed)


"darcs apply -i <../foo/patch1" crashes too.

Test case:
mkdir foo 
cd foo
darcs init
cd ..
darcs get foo
cd foo
echo 123 >file1
darcs add file1
darcs rec --name=patch1 -a
darcs send -a --output=./patch1 --no-edit-description ../foo_0/
cd ../foo_0/
darcs setpref test /bin/false
# Remove < from the next line to see what is going on
darcs apply --test <../foo/patch1


Ilya
msg15626 (view) Author: bsrkaditya Date: 2012-04-28.05:55:34
Hi,
 There is already an issue very similar to this:
http://bugs.darcs.net/issue1648
There is a patch in development, but we are uncertain if the current
solution(take input from tty when using apply interactive) is
worth the user surprise.

Aditya

On Sat, Apr 28, 2012 at 4:56 AM, Ilya Perminov <bugs@darcs.net> wrote:

>
> New submission from Ilya Perminov <iperminov@dwavesys.com>:
>
> "apply" should not ask anything if it is reading patches from stdin.
>
> "darcs apply --test <patch-set" crashes if the test fails, because it
> attempts to ask "Shall I apply them anyway? [yN]":
> Running test...
>
> Test failed!
>
> Looks like those patches do not pass the tests.
> darcs-2.8.0: <stdin>: hIsTerminalDevice: illegal operation (handle is
> closed)
>
>
> "darcs apply -i <../foo/patch1" crashes too.
>
> Test case:
> mkdir foo
> cd foo
> darcs init
> cd ..
> darcs get foo
> cd foo
> echo 123 >file1
> darcs add file1
> darcs rec --name=patch1 -a
> darcs send -a --output=./patch1 --no-edit-description ../foo_0/
> cd ../foo_0/
> darcs setpref test /bin/false
> # Remove < from the next line to see what is going on
> darcs apply --test <../foo/patch1
>
>
> Ilya
>
> ----------
> messages: 15625
> nosy: ilya
> priority: bug
> status: unknown
> title: apply: hIsTerminalDevice: illegal operation (handle is closed)
>
> __________________________________
> Darcs bug tracker <bugs@darcs.net>
> <http://bugs.darcs.net/issue2187>
> __________________________________
> _______________________________________________
> darcs-devel mailing list
> darcs-devel@darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-devel
>



-- 
BSRK Aditya
Attachments
msg15628 (view) Author: ilya Date: 2012-04-28.20:22:41
Hi,

Please ignore "apply -i" part of this bug report, it is the same as
1648. I somehow missed it.
However, failing "apply --test" is a different issue. It happens always,
even when "-i" is not used.

Ilya
msg15722 (view) Author: kowey Date: 2012-05-26.06:56:49
Do I understand correctly that the objection is not to apply failing but 
to the illegal operation on handle close?  It's supposed to fail, as far 
as I can tell.  Thanks for the tests.  Yours are quite readable.

    rc <- testTentative repository
    when (rc /= ExitSuccess) $ do
        when (not $ isInteractive opts) $ exitWith rc
        putStrLn $ "Looks like those patches do not pass the tests."
        let prompt = "Shall I apply them anyway?"
        yn <- promptChar (PromptConfig prompt "yn" [] (Just 'n') [])
        case yn of
          'y' -> return ()
          _ -> exitWith rc

I've tacked on a small refactor task for anybody who wants to work on 
this
msg15729 (view) Author: ilya Date: 2012-05-29.19:14:08
Yes, the issue is reading from a closed handle.
History
Date User Action Args
2012-04-27 23:26:09ilyacreate
2012-04-28 05:55:35bsrkadityasetfiles: + unnamed
messages: + msg15626
2012-04-28 20:22:42ilyasetmessages: + msg15628
2012-05-26 06:56:50koweysetstatus: unknown -> needs-diagnosis/design
messages: + msg15722
superseder: + refactor Darcs.Test and Darcs.Repository.Internal.testAny
2012-05-29 19:14:09ilyasetmessages: + msg15729