[GHC] #10172: Cross-platform sed

#10172: Cross-platform sed -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build | Version: 7.11 System | Operating System: Solaris Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- It's quite easy to accidentally use GNU extensions in sed expressions, which means Solaris builds start failing. See https://phabricator.haskell.org/D740 for an example. What should we do? Here are a few possibilities: * Force use of POSIX sed with `--posix` flag. I haven't tested, but maybe this won't work if Solaris sed chokes on the `--posix`. Alternately, use `$(SED)` and add `--posix` only if it's supported * Detect GNU sed in autoconfigure and use `$(SED)` in all Makefile scripts * Stop using sed in the scripts for something else I don't know if this admonition applies to other random POSIX tools we use. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10172: Cross-platform sed -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Solaris | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by kgardas): Solaris sed does not support --posix. Please note I'm using sed from /usr/xpg4/bin -- which means this should be posix compliant sed. Also so far we've always been able to come with some posix compliant solution. Perhaps even for this someone will find one. I'll have some time to deal with it during the weekend hopefully... Anyway, so I'm for (1) use POSIX sed features only, although --posix command-line option is pure GNU-ism probably. When this really does not work, then switch to (2) require GNU sed and so in makefiles use $(SED) and provide appropriate configure.ac machinery for this... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10172: Cross-platform sed -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Solaris | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): If I understand correctly, there is no way to get EREs from POSIX sed. It would be really nice to have a way of clamping to POSIX-only even on Linux; makes it less likely for devs to mess it up. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10172: Cross-platform sed -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Solaris | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomie): Can't we just make life easy for the majority of developers, and require GNU tools. There are already so many things to keep in mind when submitting a patch to GHC, why make it even harder? What's the problem with installing GNU tools on Solaris? It would also free up time to fix *actual* problems on Solaris (there are plenty, judging by the failing tests on the nightly builders), not these silly compatibility issues. For reference, in `configure.ac`: {{{ dnl ** Find the path to sed AC_PATH_PROGS(SedCmd,gsed sed,sed) dnl ** check for time command AC_PATH_PROG(TimeCmd,time) dnl ** check for tar dnl if GNU tar is named gtar, look for it first. AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) dnl ** check for patch dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) }}} Also: {{{ commit 22f78dd456cdf6d6c123556e3f715d008ecd86cd Author: Ian Lynagh <> Date: Tue Dec 1 13:07:41 2009 +0000 Look for sed as gsed first Solaris's sed apparently doesn't understand [:space:] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10172: Cross-platform sed -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Solaris | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by kgardas): thomie, honestly I really like I can compile GHC and use canonical Single- Unix Specification version 3 tools for it minus GNU make which is really non-replacable at least for now. Just see https://www.freebsd.org/cgi/man.cgi?query=standards&apropos=0&sektion=0&manpath=SunOS+5.10&arch=default&format=html -- I'm using configuration to set the OS to POSIX.1-2001, SUSv3 level. Anyway, if devs decide let's go with GNU tools (patch/diff/sed) together with GNU make I will not strike against this, don't have energy for it. The question is ROI of such change, do we need it *now*? I don't think so, Solaris builders are running fine on current HEAD. How often do we need to tweak sed invocation in current build system? 4x per calendar year? So let's decide once this thing is again broken not now when everything is working fine. Side note: shouldn't we already use shake for building GHC? Not complaining, but from this spring I've got an impression that shake is on the way to GHC and that it would solve several issues I also do have with build system myself (too low usage of available cores). If this all still applies, then I would suggest not to touch current make-based system, keep it just working with as low energy as possible and concentrate on other GHC important tasks... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10172: Cross-platform sed ---------------------------------+---------------------------------------- Reporter: ezyang | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Solaris | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by thomie): kgardas: in Phab:D1467, we need to do some arithmetic. Does running `echo $((2*1000 + 16*10 + 0))` in the shell result in `2160` on all your systems? Or is it better to use `expr`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10172#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC