[GHC] #8886: sync-all: END actions result in confusing error message
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Building GHC Difficulty: Easy (less than 1 | failed hour) | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- The instructions at [wiki:Newcomers] were slightly outdated, and result in a rather confusing error message: {{{ $ ./sync-all --testsuite get Unrecognised flag: --testsuite at ./sync-all line 872. == Checking for old haddock repo == Checking for old binary repo == Checking for old mtl repo == Checking for old Cabal repo == Checking for old time from tarball ============================ ATTENTION! You have an old time package in your GHC tree! Please remove it (e.g. "rm -r libraries/time"), and then run "./sync-all get" to get the new repository. ============================ == Checking for obsolete Git repo URL $ }}} The patch suppresses the misleading error message. I've already removed the `--testsuite` flag from the wiki page. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by fw): * version: 7.6.3 => -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Build System | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by fw): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Building GHC | Difficulty: Easy (less than 1 failed | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged, thanks! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: new Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Changes (by thomie): * status: closed => new * component: Build System => Trac & Git * owner: => hvr * failure: Building GHC failed => None/Unknown * keywords: => sync-all * resolution: fixed => Comment: This commit should be reverted IMHO. The idea of using the `END` block, if I understand correctly, is that it should run at the end, no matter what else happens. For example the change back to the `initial_working_directory` should not be skipped in case of errors. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: patch Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Changes (by thomie): * status: new => patch Comment: The false warning is also triggered when running a different `sync-all` command before the first succesful `sync-all get`, for example if one runs (for whatever reason): git clone git://github.com/ghc/ghc cd ghc ./sync-all -r http://git.haskell.org remote set-url origin The attached patch proposes a solution. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: patch Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by fw): Replying to [comment:4 thomie]:
The idea of using the `END` block, if I understand correctly, is that it should run at the end, no matter what else happens. For example the change back to the `initial_working_directory` should not be skipped in case of errors.
If the script dies with an error, the process is probably in a slightly broke state, and printing all those warnings only obscures the error. Changing the directory does not in itself have any effect because the process is about to terminate anyway, and its not the point of the `END` action. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: patch Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by thomie): Ok, you're right that changing the directory is not needed. But one thing I don't understand: why are those checks in the `END` block, if not for running even on an error. Wouldn't they be better placed straight in the main function then? Would make things simpler. I guess the author of those old repository checks in the `END` block thought about potential errors that could occur, and deemed it necessary to show those warnings. Yes it obscures the initial error, but maybe that error is caused by having an old repository in the first place. The bug that still stands is getting false warnings about old time library being present when running another command before `sync-all get`. My patch fixes that. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: patch Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by fw): Replying to [comment:7 thomie]:
Ok, you're right that changing the directory is not needed.
But one thing I don't understand: why are those checks in the `END` block, if not for running even on an error. Wouldn't they be better placed straight in the main function then?
Probably, I don't understand they way the script is written. I have seen some Perl in my day, and this usage of `BEGIN` (for argument parsing, of all) and `END` blocks seemed highly suspect to me. I didn't want to audit the code for any forms of non-local control flow, so I put in just the exception check as a minimal, less risky change. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------+------------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: patch Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by Austin Seipp <austin@…>): In [changeset:"7012ed8515100b4947383e93b82dbff7a0aa835c/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="7012ed8515100b4947383e93b82dbff7a0aa835c" Check if file is present instead of directory Fixes #8886. Problem: any `sync-all` command that is run before the first succesfull `sync-all get` would trigger a false warning about an old `time` package being present. Cause: after cloning the ghc repository, the (empty) `libraries/time` directory is already present. Solution: check if the directory actually contains any of the `time` files. I picked the `LICENSE` file, since `boot` does so as well. Signed-off-by: Austin Seipp <austin@well-typed.com> }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: closed Priority: normal | Milestone: Component: Trac & Git | Version: Resolution: fixed | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Trac & Git | Version: Resolution: fixed | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: => 7.10.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8886: sync-all: END actions result in confusing error message -------------------------------------+------------------------------------- Reporter: fw | Owner: hvr Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Trac & Git | Version: Resolution: fixed | Keywords: sync-all Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Easy (less than 1 Type of failure: | hour) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Austin Seipp <austin@…>): In [changeset:"0f31c2e5c1cf240a78221bb09578f6eb7084ada5/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="0f31c2e5c1cf240a78221bb09578f6eb7084ada5" Cleanup and better documentation of sync-all script Summary: Rumor has it that sync-all is slowly on the way out. Now that all subrepositories have been turned into git submodules, sync-all might not be needed anymore. Nevertheless, here are some changes I had made while trying to understand why it existed in the first place: * update comments + help text * rename some variables for maintainability * s/branch_name/remote_name/ origin is the name of a remote, not a branch * s/repo_base/remote_root/ the word *remote* is key here * s/defaultrepo/default_root/ this was a darcsism, and it doesn't refer to a repository but to the root directory of all repositories * small tweaks * .git can be a file nowadays * don't skip END actions on exceptions #8886 reverts d523f9b3d4ce3463e8816cad2139ea397e00f8d1 Test Plan: Why revert d523f9b3d4ce3463e8816cad2139ea397e00f8d1? I put an old haddock repository from http://darcs.haskell.org/haddock2.git back in my tree. Now, when running `sync-all get`, the following happens: 1. I get a cryptic error saying: fatal: reference is not a tree: 5412c262f403e52be45d607b34eb3a5806ea2a76 Unable to checkout '5412c262f403e52be45d607b34eb3a5806ea2a76' in submodule path 'utils/haddock' git failed: 256 at ./sync-all line 112. 2. sync-all checks if maybe an old haddock repository is present 3. I get a clear warning saying: ============================ ATTENTION! You have an old haddock repository in your GHC tree! Please remove it (e.g. "rm -r utils/haddock"), and then run "./sync-all get" to get the new repository. ============================ Without commit d523f9b3d4ce3463e8816cad2139ea397e00f8d1 reverted, steps 2 and 3 were skipped. The problem that commit tried to solve, is now solved with 7012ed8515100b4947383e93b82dbff7a0aa835c. Reviewers: nomeata, austin, hvr Reviewed By: austin, hvr Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D178 GHC Trac Issues: #8886, #9212 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8886#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC