[bug] Frontend installer creates a file instead of a directory, then fails to create the actual directory #836

Closed
opened 2024-10-16 15:27:40 +00:00 by tudbut · 1 comment
Contributor

Your setup

From source

Extra details

Arch Linux ARM

Version

v1.1.5-9040-g050bc7443

PostgreSQL version

16.3

What were you trying to do?

I was trying to run sudo -Hu akkoma MIX_ENV=prod mix pleroma.frontend install pleroma-fe --ref stable.

What did you expect to happen?

The frontend would install

What actually happened?

An error.

Logs

debugging messages were added by myself
```
17:19:41.148 [info] Extracting file /opt/akkoma/instance/static/frontends/tmp/dist
17:19:41.148 [info] Extracting file /opt/akkoma/instance/static/frontends/tmp/dist/chunk-2be3.6f800265.css
** (File.Error) could not make directory (with -p) "/opt/akkoma/instance/static/frontends/tmp/dist": file already exists
    (elixir 1.17.3) lib/file.ex:346: File.mkdir_p!/1
    (pleroma 3.13.2) lib/pleroma/frontend.ex:86: anonymous fn/2 in Pleroma.Frontend.unzip/2
    (elixir 1.17.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
    (pleroma 3.13.2) lib/pleroma/frontend.ex:38: Pleroma.Frontend.install/2
    (mix 1.17.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.17.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    /usr/bin/mix:2: (file)
```
The issue is that the zip contains the directories which the installer does not differentiate from regular files.

Severity

I cannot use the software

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup From source ### Extra details Arch Linux ARM ### Version v1.1.5-9040-g050bc7443 ### PostgreSQL version 16.3 ### What were you trying to do? I was trying to run `sudo -Hu akkoma MIX_ENV=prod mix pleroma.frontend install pleroma-fe --ref stable`. ### What did you expect to happen? The frontend would install ### What actually happened? An error. ### Logs ````shell debugging messages were added by myself ``` 17:19:41.148 [info] Extracting file /opt/akkoma/instance/static/frontends/tmp/dist 17:19:41.148 [info] Extracting file /opt/akkoma/instance/static/frontends/tmp/dist/chunk-2be3.6f800265.css ** (File.Error) could not make directory (with -p) "/opt/akkoma/instance/static/frontends/tmp/dist": file already exists (elixir 1.17.3) lib/file.ex:346: File.mkdir_p!/1 (pleroma 3.13.2) lib/pleroma/frontend.ex:86: anonymous fn/2 in Pleroma.Frontend.unzip/2 (elixir 1.17.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2 (pleroma 3.13.2) lib/pleroma/frontend.ex:38: Pleroma.Frontend.install/2 (mix 1.17.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5 (mix 1.17.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2 /usr/bin/mix:2: (file) ``` The issue is that the zip contains the directories which the installer does not differentiate from regular files. ```` ### Severity I cannot use the software ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
tudbut added the
bug
label 2024-10-16 15:27:40 +00:00
Author
Contributor

The issue is fixed by adding

new_file_path
|> Path.dirname()
|> File.rm()

first in lib/pleroma/frontend.ex, but this is a suboptimal fix as it does not address the root cause (the zip file being incorrectly assembled to include dirs).

The issue is fixed by adding ```ex new_file_path |> Path.dirname() |> File.rm() ``` first in lib/pleroma/frontend.ex, but this is a suboptimal fix as it does not address the root cause (the zip file being incorrectly assembled to include dirs).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#836
No description provided.