www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21656] New: [REG2.091] Wrong file read during exception


          Issue ID: 21656
           Summary: [REG2.091] Wrong file read during exception
                    stringification leads to SIGBUS
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

/////////////// bug.d //////////////
void main()
        throw new Exception("Test");
    catch (Exception e)

To reproduce:

dmd bug.d && mkdir -p a && cd a && touch bug && PATH=.. bug

Introduced in https://github.com/dlang/druntime/pull/2330

There might be two bugs here:

1. The wrong file is being read. This is the more important bug. It might
contain something else entirely, or even point to something that the problem
really should not access. (In my case, it pointed to a directory hosting a FUSE
filesystem provided by the program - so it therefore had the same name as the
program - which led to a deadlock.)

2. Perhaps an empty file should not cause a SIGBUS. The executable file may
have been modified between the point when the program was started and when
Druntime attempts to read it. For example, if the developer is recompiling the
program while an older instance is still running, said instance could
conceivably see an empty file as the compiler is writing the new version.

Feb 22 2021