Skip to content

Fixed #5225 - #6110

Merged
nad merged 3 commits into
masterfrom
issue5225
Sep 19, 2022
Merged

nad merged 3 commits into
masterfrom
issue5225

Conversation

@nad

@nad nad commented Sep 18, 2022 •

Copy link
Copy Markdown
Collaborator

(Andreas: Goal of this PR: speed up generation of <builtin>.agdai files during setup.)

@nad nad self-assigned this Sep 18, 2022
@andreasabel andreasabel added this to the 2.6.3 milestone Sep 19, 2022
@nad
nad merged commit 0861274 into master Sep 19, 2022
@nad
nad deleted the issue5225 branch September 19, 2022 15:27

@andreasabel andreasabel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR likely makes installation via stack fail on windows.

Comment thread Setup.hs
, "-v0"
])
{ std_in = CreatePipe
, std_out = CreatePipe

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Considering that under Windows, Setup freezes now, and the easiest explanation would be a blocked pipe, maybe you fell into a similar trap as I did, see

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I put here std_out = UseHandle stdout, then Setup runs correctly!

But then, Agda prints annoying emacs commands. So, the correct fix is probably to redirect the stdout but then swallow it in case Agda finished successfully.

Comment thread Setup.hs
ExitSuccess -> return ()
ExitFailure _ ->
die "Error: Failed to typecheck a builtin module!")
(\(Just wr, Just _, Nothing, p) -> do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You never consume the output generated by Agda, since you even throw away the output handle created by CreatePipe. This means that the pipe will block once it is full, and the buffer size is OS-specific. As a consequence Setup might freeze, such as we experience under Windows.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read that you have access to a Windows machine with a suitable build environment. Can you fix this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following code seems to work under Linux:

import Control.Concurrent (forkIO)
    (\(Just wr, Just rd, Nothing, p) -> do
       mapM_ (flip hSetEncoding utf8) [wr, rd]
       hSetBuffering wr LineBuffering
       -- TODO: Document why the following line is here.
       _ <- forkIO (hGetContents rd >> return ())
       mapM_ (hPutStrLn wr) loadBuiltinCmds)

andreasabel added a commit that referenced this pull request Oct 23, 2022
Regression introduced by #6110.

The output of the created Agda process was never read,
resulting in a blocked pipe when the buffer was full.

Using the simpler `readCreateProcess` takes care of
the correct pipe handling for us.
andreasabel added a commit that referenced this pull request Oct 23, 2022
Regression introduced by #6110.

The output of the created Agda process was never read,
resulting in a blocked pipe when the buffer was full.

Using the simpler `readCreateProcess` takes care of
the correct pipe handling for us.
andreasabel added a commit that referenced this pull request Oct 23, 2022
Regression introduced by #6110.

The output of the created Agda process was never read,
resulting in a blocked pipe when the buffer was full.

Using the simpler `readCreateProcess` takes care of
the correct pipe handling for us.
andreasabel added a commit that referenced this pull request Oct 23, 2022
Regression introduced by #6110.

The output of the created Agda process was never read,
resulting in a blocked pipe when the buffer was full.

Using the simpler `readCreateProcess` takes care of
the correct pipe handling for us.
andreasabel added a commit that referenced this pull request Oct 23, 2022
Regression introduced by #6110.

The output of the created Agda process was never read,
resulting in a blocked pipe when the buffer was full.

Using the simpler `readCreateProcess` takes care of
the correct pipe handling for us.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants