When building the JDK with the sources in a readonly filesystem, generation of ScopedMemoryAccess.java fails:
```
Exception in thread "main" java.io.FileNotFoundException: build/support/gensrc/java.base/jdk/internal/misc/ScopedMemoryAccess.java (Permission denied)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:155)
at build.tools.spp.Spp.main(Spp.java:103)
make[3]: *** [build/support/gensrc/java.base/jdk/internal/misc/ScopedMemoryAccess.java] Error 1
```
The logic that generates that file starts by copying a template, and then appending to the copied file:
https://github.com/openjdk/jdk/blob/52d88ee1d1e0f6b9927db03a2b0bff75e4be03a2/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk#L145
A potential trivial fix is just to use cat instead of cp:
- $(CP) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_DEST)
+ $(CAT) $(SCOPED_MEMORY_ACCESS_TEMPLATE) > $(SCOPED_MEMORY_ACCESS_DEST)
The readonly filesystem bit here is unusual and presumably not going to be a common problem, but this is the only instance of this problem in the build and is trivial to fix.
```
Exception in thread "main" java.io.FileNotFoundException: build/support/gensrc/java.base/jdk/internal/misc/ScopedMemoryAccess.java (Permission denied)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:155)
at build.tools.spp.Spp.main(Spp.java:103)
make[3]: *** [build/support/gensrc/java.base/jdk/internal/misc/ScopedMemoryAccess.java] Error 1
```
The logic that generates that file starts by copying a template, and then appending to the copied file:
https://github.com/openjdk/jdk/blob/52d88ee1d1e0f6b9927db03a2b0bff75e4be03a2/make/modules/java.base/gensrc/GensrcScopedMemoryAccess.gmk#L145
A potential trivial fix is just to use cat instead of cp:
- $(CP) $(SCOPED_MEMORY_ACCESS_TEMPLATE) $(SCOPED_MEMORY_ACCESS_DEST)
+ $(CAT) $(SCOPED_MEMORY_ACCESS_TEMPLATE) > $(SCOPED_MEMORY_ACCESS_DEST)
The readonly filesystem bit here is unusual and presumably not going to be a common problem, but this is the only instance of this problem in the build and is trivial to fix.