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

asciidoctor-diagram in combination with plantuml create ? directory in source directory #471

Open
sdavids opened this issue Sep 11, 2024 · 2 comments

Comments

@sdavids
Copy link

sdavids commented Sep 11, 2024

$ mkdir -p /tmp/test && cd "$_"
$ mkdir src build
$ cat << 'EOF' >src/test.adoc
[plantuml]
----
@startuml

label Test

@enduml
----
EOF
$ tree -a --noreport /tmp/test
/tmp/test
├── build
└── src
    └── test.adoc
$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test/src:/documents' \
  -v '/tmp/test/build:/mnt/build' \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -D /mnt/build -r asciidoctor-diagram test.adoc'
Fontconfig error: No writable cache directories
...
$ tree -a --noreport /tmp/test
/tmp/test
├── build
│   ├── .asciidoctor
│   │   └── diagram
│   │       └── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png.cache
│   ├── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png
│   └── test.pdf
└── src
    ├── ?
    │   └── .java
    │       └── fonts
    │           └── 17.0.12
    │               └── fcinfo-1-ddfe350edc90-Alpine Linux-3.20.3-en-US.properties
    └── test.adoc

Notice the creation of the src/? directory.

I am not sure if it is a side-effect of #470.

Regardless, this directory should be created somewhere else so one can mount the src directory as readonly:

$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test/src:/documents:ro' \
  -v '/tmp/test/build:/mnt/build' \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -D /mnt/build -r asciidoctor-diagram test.adoc'
@sdavids
Copy link
Author

sdavids commented Sep 11, 2024

Even when setting XDG_CACHE_HOME (see #470 (comment)) the src/? directory is still created.

So this has to be configured somewhere else.

$ mkdir -p /tmp/test && cd "$_"
$ mkdir src build
$ cat << 'EOF' >src/test.adoc
[plantuml]
----
@startuml

label Test

@enduml
----
EOF
$ docker run \
  --rm \
  -u "$(id -u):$(id -g)" \
  -v '/tmp/test/src:/documents' \
  -v '/tmp/test/build:/mnt/build' \
  -e XDG_CACHE_HOME=/tmp \
  asciidoctor/docker-asciidoctor:1.76.0 \
  sh -c 'asciidoctor-pdf -D /mnt/build -r asciidoctor-diagram test.adoc'
$ tree -a --noreport /tmp/test
/tmp/test
├── build
│   ├── .asciidoctor
│   │   └── diagram
│   │       └── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png.cache
│   ├── diag-plantuml-md5-e44a8461ee81fc745bd01cef0a04d9dc.png
│   └── test.pdf
└── src
    ├── ?
    │   └── .java
    │       └── fonts
    │           └── 17.0.12
    │               └── fcinfo-1-a3cb5d7b7654-Alpine Linux-3.20.3-en-US.properties
    └── test.adoc

@sdavids
Copy link
Author

sdavids commented Sep 11, 2024

$ echo "$(id -u):$(id -g)"
502:20
$  docker run --rm -u "$(id -u):$(id -g)" asciidoctor/docker-asciidoctor:1.76.0 whoami
whoami: unknown uid 502

$ docker run --rm -v '/tmp/test/src:/documents' -e XDG_CACHE_HOME=/tmp asciidoctor/docker-asciidoctor:1.76.0 sh -c 'adduser -D test && su -c "asciidoctor-pdf -r asciidoctor-diagram test.adoc" -- test && ls -AR /home/test'
/home/test:
.java

/home/test/.java:
fonts

/home/test/.java/fonts:
17.0.12

/home/test/.java/fonts/17.0.12:
fcinfo-1-1d1cec97232f-Alpine Linux-3.20.3-en-US.properties

So apparently asciidoctor-diagram/plantUML/JDK has to be configured somehow to not write in $HOME but in some other place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant