Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recompilation errors go to stderr, not xmonad.errors #403

Open
2 tasks done
geekosaur opened this issue Jul 4, 2022 · 12 comments
Open
2 tasks done

recompilation errors go to stderr, not xmonad.errors #403

geekosaur opened this issue Jul 4, 2022 · 12 comments
Milestone

Comments

@geekosaur
Copy link
Contributor

Problem Description

Recompilation errors go directly to standard error instead of the log file. This means that, to find out what actually went wrong with xmonad --recompile, you need to run it in a terminal. Otherwise, you get an xmessage showing the build command but not its output, at least when using a build script (but IIRC these all use the same code path, so stack and ghc should fail the same way).

Steps to Reproduce

Introduce a syntax error into your config and press mod-q

Configuration File

module Main (main) where

import XMonad

main :: IO ()
main = xmonad def

*

Checklist

  • I've read CONTRIBUTING.md

  • I tested my configuration

    • With xmonad version 0.17.0.9 (commit 521e835 if using git)
    • [n/a] With xmonad-contrib version XXX (commit XXX if using git)
@slotThe
Copy link
Member

slotThe commented Jul 28, 2022

Are you sure about this? We're using withFile here and our runProc would seem to me to do the correct thing with regards to redireciting stderr to xmonad.errors

@geekosaur
Copy link
Contributor Author

It's quite reliable here: nothing useful in the error popup generated from xmonad.errors, I have to run it in a terminal.

@slotThe
Copy link
Member

slotThe commented Aug 2, 2022

Mh, it works perfectly fine here, but I do have my config in its own stack project with a build file1. I will try to reproduce this with just the stack/ghc setup that we support ootb.

Footnotes

  1. Although the entirety of that file is

    #!/bin/sh
    cd "$XMONAD_CONFIG_DIR" && stack build --reconfigure || exit
    ln -f -T "$(stack exec -- which xmonadrc)" "$1"
    

@slotThe
Copy link
Member

slotThe commented Aug 7, 2022

Okay, I've now tried this with both our stack and ghc setups and can't reproduce it at all. Can you perhaps create a repo or something with a reproducer?

@geekosaur
Copy link
Contributor Author

geekosaur commented Aug 7, 2022

That's odd since I've reproduced it here with both my normal setup and one of my testing sandboxes. Maybe it is relevant that both use build scripts with cabal, though. (Neither is trivial, though, else they wouldn't be using build scripts….)

@geekosaur
Copy link
Contributor Author

And I have a minimal reproducer, again using cabal with a build script; see https://github.com/geekosaur/xmonad.hs/tree/xmonad-buildscript-fail. Compare terminal.out with xmessage.out.

@slotThe
Copy link
Member

slotThe commented Aug 7, 2022

Indeed, I can reproduce it with that. It seems like the build script (or cabal? I don't know) sends compilation errors to stdout and not stderr. When I do xmonad --recompile 1>xmonad.stdout I only get the content of xmessage.out printed in the terminal, while the (relevant) contents of terminal.errors are sent to xmonad.stdout.

@slotThe slotThe added this to the v0.18.0 milestone Aug 27, 2022
@slotThe
Copy link
Member

slotThe commented Sep 4, 2022

@geekosaur is this something that we can fix in a cabal build file? Is it a good idea to redirect stdout to xmonad.errors as well?

@geekosaur
Copy link
Contributor Author

I'm a bit surprised it's not already, to be honest.

I could arrange for my build script and/or the cabal example build script to redirect stdout to stderr. I feel like it shouldn't be necessary, though. But this sounds like an upstream cabal issue, since it's redirecting stderr to stdout.

@slotThe
Copy link
Member

slotThe commented Sep 5, 2022

Looks like there has been attempts haskell/cabal#4789 and, more recently, haskell/cabal#7838. The latter seems to be active, so hopefully this will get fixed soon.

@jrgiacone
Copy link

Not sure what changed as well, I have xmessage installed but errors are not displayed, only shown in the xmonad.errors file

@geekosaur
Copy link
Contributor Author

That would be a different issue: if they're making it to xmonad.errors then it's launching xmessage that is failing. Is it in /usr/bin? If not, you may need to arrange for xmonad to be run with an appropriate $PATH (which most X11 startup configurations won't do for you: they force PATH=/bin:/usr/bin).

duplode added a commit to duplode/xmonad-duplode that referenced this issue Jan 15, 2024
@liskin liskin modified the milestones: v0.18.0, v0.19.0 Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants