From a689c8edb1639669cb8df58092b8b77a0a581717 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 20 Nov 2015 07:26:42 -0600 Subject: ghci: don't let ctags/etags overwrite source files A ource file which was accidently passed as parameter into `:ctags` or `:etags` can be overwritten by tag data. This patch updates documentation to avoid confusion in commands usage and prevents `collateAndWriteTags` from modifying existing source files. Reviewed By: thomie, bgamari, austin Differential Revision: https://phabricator.haskell.org/D1471 GHC Trac Issues: #10989 --- testsuite/tests/ghci/scripts/T10989.script | 15 +++++++++++++++ testsuite/tests/ghci/scripts/T10989.stderr | 6 ++++++ testsuite/tests/ghci/scripts/T10989.stdout | 2 ++ testsuite/tests/ghci/scripts/all.T | 5 +++++ 4 files changed, 28 insertions(+) create mode 100644 testsuite/tests/ghci/scripts/T10989.script create mode 100644 testsuite/tests/ghci/scripts/T10989.stderr create mode 100644 testsuite/tests/ghci/scripts/T10989.stdout (limited to 'testsuite/tests') diff --git a/testsuite/tests/ghci/scripts/T10989.script b/testsuite/tests/ghci/scripts/T10989.script new file mode 100644 index 0000000000..d109e4eeda --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10989.script @@ -0,0 +1,15 @@ +writeFile "dummy.hs" "t = putStrLn \"Test\"" +writeFile "dummy.lhs" "> t = putStrLn \"Test\"" +:ctags dummy.hs +:ctags dummy.lhs +:ctags! dummy.hs +:ctags! dummy.lhs +:etags dummy.hs +:etags dummy.lhs +:ctags dummy.tags +:ctags! dummy.tags +:etags dummy.tags +:l dummy.hs +t +:l dummy.lhs +t diff --git a/testsuite/tests/ghci/scripts/T10989.stderr b/testsuite/tests/ghci/scripts/T10989.stderr new file mode 100644 index 0000000000..97b0d90ccf --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10989.stderr @@ -0,0 +1,6 @@ +dummy.hs is existing source file. Please specify another file name to store tags data +dummy.lhs is existing source file. Please specify another file name to store tags data +dummy.hs is existing source file. Please specify another file name to store tags data +dummy.lhs is existing source file. Please specify another file name to store tags data +dummy.hs is existing source file. Please specify another file name to store tags data +dummy.lhs is existing source file. Please specify another file name to store tags data diff --git a/testsuite/tests/ghci/scripts/T10989.stdout b/testsuite/tests/ghci/scripts/T10989.stdout new file mode 100644 index 0000000000..95306f6347 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10989.stdout @@ -0,0 +1,2 @@ +Test +Test diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 283251cf1f..1a664d128d 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -221,3 +221,8 @@ test('T10466', normal, ghci_script, ['T10466.script']) test('T10501', normal, ghci_script, ['T10501.script']) test('T10508', normal, ghci_script, ['T10508.script']) test('T10520', normal, ghci_script, ['T10520.script']) +test('T10989', + [ + extra_clean(['dummy.hs', 'dummy.lhs', 'dummy.tags']) + ], + ghci_script, ['T10989.script']) -- cgit v1.2.1