Opened 4 years ago

Closed 4 years ago

#9905 closed bug (fixed)

ghc-7.8.x command line error

Reported by: zRecursive Owned by: rwbarton
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D581
Wiki Page:

Description

$ghc -e "import Data.List" -e "print 9" will not output 9 but ghc -e "print 9" works normally. However, both commands work on ghc-7.6.x.

Regards!

Change History (11)

comment:1 Changed 4 years ago by pgj

Is this unique to FreeBSD? Does not the same happens on other platforms?

comment:2 in reply to:  1 Changed 4 years ago by pgj

Operating System: FreeBSDUnknown/Multiple

Replying to pgj:

Is this unique to FreeBSD? Does not the same happens on other platforms?

I have just checked on Windows, it works the same way. Thus I have the gut feeling that something in GHC itself was changed, this is not related to the actual platform. Perhaps the consequent -e flags are not processed any more, only the first one?

comment:3 Changed 4 years ago by pgj

Type of failure: None/UnknownIncorrect result at runtime

comment:4 Changed 4 years ago by thomie

It's the import itself that is causing ghc-7.8 and later to fail.

$ ghc-7.6.3 -e "import Data.List"
$ echo $?
0

$ ghc-7.8.3 -e "import Data.List"
$ echo $?
1

$ ghc-7.9.20141219 -e "import Data.List"
$ echo $?
1

comment:5 Changed 4 years ago by rwbarton

So, ghc 7.6 did not care if an expression given to -e failed to compile; it would exit with status code 0 or proceed to the next -e flag. See #7962.

That could explain all the results here, except that in ghc 7.6, -e "import Data.List" actually works: try ghc-7.6.3 -e "import Data.List" -e "sort [2,1]". This no longer works in ghc 7.8, so there is certainly something to fix here.

comment:6 Changed 4 years ago by rwbarton

Owner: set to rwbarton

comment:7 Changed 4 years ago by rwbarton

Differential Rev(s): Phab:D581

comment:8 Changed 4 years ago by Reid Barton <rwbarton@…>

In 878910e1c4520732ab9d8372c1c81f00d484e48f/ghc:

Make ghc -e not exit on valid import commands (#9905)

Summary:
Some Trues and Falses were mixed up due to Bool being used in
different senses in different parts of GHCi.

Test Plan: harbormaster; validate

Reviewers: austin

Reviewed By: austin

Subscribers: carter, thomie

Differential Revision: https://phabricator.haskell.org/D581

GHC Trac Issues: #9905

Conflicts:
	ghc/InteractiveUI.hs

comment:9 Changed 4 years ago by rwbarton

Status: newmerge

Austin: please merge cc510b46b4f6046115cd74acc2c8726c91823bcf/ghc also, thanks.

comment:10 Changed 4 years ago by rwbarton

Milestone: 7.10.1

comment:11 Changed 4 years ago by hvr

Resolution: fixed
Status: mergeclosed

has been cherry-picked into ghc-7.10 branch

Note: See TracTickets for help on using tickets.