Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#10408 closed bug (fixed)

The behavior of -ignore-dot-ghci and -ghci-script are weird

Reported by: watashi Owned by:
Priority: normal Milestone: 8.0.1
Component: GHCi Version: 7.10.1
Keywords: Cc: simonmar, hvr
Operating System: Linux Architecture: x86
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D887
Wiki Page:

Description

$ for i in `seq 10`; do echo "print $i" > /tmp/$i.ghci; done
$ ghc -e 0 -ghci-script /tmp/1.ghci -ghci-script /tmp/2.ghci
2
1
0
$ ghc -e 0 -ghci-script /tmp/1.ghci -ghci-script /tmp/2.ghci -ignore-dot-ghci
0

-ghci-script are executed in reverse order and are ignored when -ignore-dot-ghci is specified, while I expected that:

  • -ghci-script are executed in the order they are specified;
  • -ignore-dot-ghci only ignores the default .ghci files but still executes the scripts passed by -ghci-script.

I would like to change the behavior to the expected ones. But in case there are users relying on the old behavior, then it might be necessary to introduce different flags.

Change History (8)

comment:1 Changed 3 years ago by watashi

Differential Rev(s): Phab:D887

comment:2 Changed 3 years ago by Austin Seipp <austin@…>

In f5188f3acd73a07b648924a58b9882c2d0a3dbcb/ghc:

Fix weird behavior of -ignore-dot-ghci and -ghci-scipt

 * Make `-ghci-script` be executed in the order they are specified;
 * Make `-ignore-dot-ghci` only ignores the default .ghci files but
   still execute the scripts passed by `-ghci-script`.

Reviewed By: simonmar, austin

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

GHC Trac Issues: #10408

comment:3 Changed 3 years ago by thoughtpolice

Milestone: 7.12.1
Resolution: fixed
Status: newclosed

Merged, thanks!

comment:4 Changed 3 years ago by thomie

Owner: watashi deleted
Resolution: fixed
Status: closednew

SPJ reports:

Strange testsuite failure

Is this expected?  Just started happening for me

 

=====> T8333(normal) 140 of 185 [0, 0, 0]

cd . && $MAKE -s --no-print-directory T8333    </dev/null > T8333.run.stdout 2> T8333.run.stderr

Actual stdout output differs from expected:

--- ./T8333.stdout 2015-01-27 13:00:30.000000000 +0000

+++ ./T8333.run.stdout  2015-05-13 11:54:03.199711197 +0100

@@ -0,0 +1,4 @@

+*** WARNING: . is writable by someone else, IGNORING!

+Suggested fix: execute 'chmod 644 .'

+*** WARNING: /home/simonpj is writable by someone else, IGNORING!

+Suggested fix: execute 'chmod 644 /home/simonpj'

*** unexpected failure for T8333(normal)

I think this is related to this ticket.

comment:5 Changed 2 years ago by ezyang

Resolution: fixed
Status: newclosed

No, it was fixed in

commit 3ef7fcedfa1ad47968ca5fa107d51a6ab7051ed7
Author: Zejun Wu <watashi@watashi.ws>
Date:   Thu May 14 10:56:51 2015 -0500

    Do not check dir perms when .ghci doesn't exist

comment:6 Changed 2 years ago by Thomas Miedema <thomasmiedema@…>

In 124f3999d78d8ef6b093e4f1bb1dcef87e4283da/ghc:

Testsuite: add -ignore-dot-ghci to some tests

Since T10408A and T10408B would become the same now, delete T10408A and
rename T10408B to T10408. The test without -ignore-dot-ghci (T10408A)
didn't add anything (#10408).

comment:7 Changed 2 years ago by mboes

Any chance this fix could be backported to the 7.10 branch? It's affecting the safety of distributing GHCi wrappers to users for building custom GHCi based interactive environments. These need to turn off reading the user's ~/.ghci just in case there's funny stuff in there, while still convincing GHCi to read a custom script.ghci during initialization.

comment:8 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

Note: See TracTickets for help on using tickets.