Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: merge | Status: closed Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: fixed Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Changes (by igloo): * status: new = closed * resolution: = fixed Comment: I've merged the patch now, and I'm pretty sure it's safe, if not optimal, so I'm closing the ticket. Patches to improve it are of course welcomed! -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: merge | Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Comment (by MagnusTherning): Replying to [comment:7 igloo]: We are using wide characters explicitly (`RegEnumKeyW`); the question is how large a buffer to pass as the third argument. All right, maybe I should have been a bit more clear :-) AFAIK the use of `TCHAR` is something that allows the programmer to switch between Unicode (in Windows parlance) and ASCII at compile time. If the W functions are used explicitly I think it'd be better to also use `wchar_t` explicitly rather than hide them behind `TCHAR`s. According to Wikipedia unicode means UTF-16 on Windows, so allowing up to 4 bytes per character will be enough, though likely a bit wasteful. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: merge | Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Comment (by igloo): Replying to [comment:6 MagnusTherning]: Replying to [comment:5 igloo]: Fixed: {{{ Sun Apr 6 21:50:51 BST 2008 Ian Lynagh [EMAIL PROTECTED] * malloc a big enough buffer for the registry functions. Fixes trac #2097. We were mallocing a byte per tchar, but tchars are normally 2 bytes big... I think they are at most 4 bytes, so we now malloc 4 * #tchars. Not sure if there is a proper function I should be using for this? }}} One way to be sure is to switch to using wide characters explicitly, i.e. to use RegOpenKeyExW rather than RegOpenKeyEx. We are using wide characters explicitly (`RegEnumKeyW`); the question is how large a buffer to pass as the third argument. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: merge | Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Comment (by MagnusTherning): Replying to [comment:5 igloo]: Fixed: {{{ Sun Apr 6 21:50:51 BST 2008 Ian Lynagh [EMAIL PROTECTED] * malloc a big enough buffer for the registry functions. Fixes trac #2097. We were mallocing a byte per tchar, but tchars are normally 2 bytes big... I think they are at most 4 bytes, so we now malloc 4 * #tchars. Not sure if there is a proper function I should be using for this? }}} One way to be sure is to switch to using wide characters explicitly, i.e. to use RegOpenKeyExW rather than RegOpenKeyEx. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: bug| Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Changes (by igloo): * owner: = igloo -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: igloo Type: merge | Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Changes (by igloo): * type: bug = merge Comment: Fixed: {{{ Sun Apr 6 21:50:51 BST 2008 Ian Lynagh [EMAIL PROTECTED] * malloc a big enough buffer for the registry functions. Fixes trac #2097. We were mallocing a byte per tchar, but tchars are normally 2 bytes big... I think they are at most 4 bytes, so we now malloc 4 * #tchars. Not sure if there is a proper function I should be using for this? }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: Type: bug| Status: new Priority: normal | Milestone: 6.8.3 Component: libraries (other) |Version: 6.8.2 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Windows| ---+ Changes (by igloo): * milestone: = 6.8.3 Comment: I can reproduce this, but it doesn't always segfault for me. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) ---+ Reporter: MagnusTherning | Owner: Type: bug | Status: new Priority: normal | Component: libraries (other) Version: 6.8.2 |Severity: normal Keywords: |Testcase: Architecture: Unknown | Os: Windows ---+ The following code throws a segmentation fault: module Main where import System.Win32.Registry listRegistry p = do putStrLn $ HKLM\\ ++ p hkey - regOpenKey hKEY_LOCAL_MACHINE p sub_paths - regEnumKeys hkey let full_subs = map ((p ++ \\) ++) sub_paths mapM_ listRegistry full_subs main = do mapM_ listRegistry [SOFTWARE\\JavaSoft] -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2097: bug in regEnumKeys (System.Win32.Registry)
#2097: bug in regEnumKeys (System.Win32.Registry) --+- Reporter: MagnusTherning |Owner: Type: bug| Status: new Priority: normal |Milestone: Component: libraries (other) | Version: 6.8.2 Severity: normal | Resolution: Keywords: | Testcase: Architecture: Unknown| Os: Windows --+- Comment (by MagnusTherning): Hmm, I didn't really intend the code to look like that. I've stuck it in hpaste: http://hpaste.org/5666 Hopefully it'll survive there long enough. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2097#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs