Cannot change tmp directory when dumping #416

Closed
opened 2025-11-02 03:22:41 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @axeloz on GitHub (Mar 2, 2017).

  • Gitea version (or commit ref): 1.0.1
  • Git version: 1.9.1
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I want to dump my Gitea instance using
./gitea dump

Unfortunately my primary partition is nearly full so the dump fails and I need to change the tmp directory that Gitea will use. In order to do so, I issue a :
./gitea dump -t ./tmp

The dump works better until I get :
Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device

This means Gitea keeps using the /tmp directory instead of the ./tmp I have created on another partition.

Thanks

Originally created by @axeloz on GitHub (Mar 2, 2017). - Gitea version (or commit ref): 1.0.1 - Git version: 1.9.1 - Operating system: Ubuntu - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant ## Description I want to dump my Gitea instance using `./gitea dump` Unfortunately my primary partition is nearly full so the dump fails and I need to change the tmp directory that Gitea will use. In order to do so, I issue a : `./gitea dump -t ./tmp` The dump works better until I get : `Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device` This means Gitea keeps using the /tmp directory instead of the ./tmp I have created on another partition. Thanks
GiteaMirror added the type/enhancement label 2025-11-02 03:22:41 -06:00
Author
Owner

@axeloz commented on GitHub (Mar 2, 2017):

I forgot to attach the full log. As you can see, the dump utility starts using the "./tmp" dir but fails at the end on "/tmp"

git@new:~/gitea$ ./gitea dump -t ./tmp/
2017/03/02 16:13:24 Creating tmp work dir: tmp/gitea-dump-488981595
2017/03/02 16:13:24 Dumping local repositories.../data/git/repositories
2017/03/02 16:16:01 Dumping database...
2017/03/02 16:16:01 Packing dump files...
2017/03/02 16:16:41 Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device
@axeloz commented on GitHub (Mar 2, 2017): I forgot to attach the full log. As you can see, the dump utility starts using the "./tmp" dir but fails at the end on "/tmp" ``` git@new:~/gitea$ ./gitea dump -t ./tmp/ 2017/03/02 16:13:24 Creating tmp work dir: tmp/gitea-dump-488981595 2017/03/02 16:13:24 Dumping local repositories.../data/git/repositories 2017/03/02 16:16:01 Dumping database... 2017/03/02 16:16:01 Packing dump files... 2017/03/02 16:16:41 Fail to save gitea-dump-1488467761.zip: write /tmp/cae/gitea-dump-1488467761.zip/gitea-repo.zip: no space left on device ```
Author
Owner

@cez81 commented on GitHub (Mar 2, 2017):

@lunny I can have a look at this one.

@cez81 commented on GitHub (Mar 2, 2017): @lunny I can have a look at this one.
Author
Owner

@cez81 commented on GitHub (Mar 2, 2017):

Try setting the TMPDIR (or equivalent for your dist) enviroment variable to same tmp dir.

The use of /tmp actually comes from the cae/zip-library. See https://github.com/Unknwon/cae/blob/master/zip/write.go#L169

@lunny Don't think I should change it the imported library right?

@cez81 commented on GitHub (Mar 2, 2017): Try setting the TMPDIR (or equivalent for your dist) enviroment variable to same tmp dir. The use of /tmp actually comes from the cae/zip-library. See https://github.com/Unknwon/cae/blob/master/zip/write.go#L169 @lunny Don't think I should change it the imported library right?
Author
Owner

@axeloz commented on GitHub (Mar 3, 2017):

Setting the TMPDIR works :

git@new:~/gitea$ export TMPDIR=./tmp
git@new:~/gitea$ ./gitea dump -t ./tmp/
2017/03/03 10:24:42 Creating tmp work dir: tmp/gitea-dump-334154876
2017/03/03 10:24:42 Dumping local repositories.../data/git/repositories
2017/03/03 10:27:20 Dumping database...
2017/03/03 10:27:20 Packing dump files...
2017/03/03 10:29:46 Removing tmp work dir: tmp/gitea-dump-334154876
2017/03/03 10:29:46 Finish dumping in file gitea-dump-1488533240.zip

Thanks

@axeloz commented on GitHub (Mar 3, 2017): Setting the TMPDIR works : ``` git@new:~/gitea$ export TMPDIR=./tmp git@new:~/gitea$ ./gitea dump -t ./tmp/ 2017/03/03 10:24:42 Creating tmp work dir: tmp/gitea-dump-334154876 2017/03/03 10:24:42 Dumping local repositories.../data/git/repositories 2017/03/03 10:27:20 Dumping database... 2017/03/03 10:27:20 Packing dump files... 2017/03/03 10:29:46 Removing tmp work dir: tmp/gitea-dump-334154876 2017/03/03 10:29:46 Finish dumping in file gitea-dump-1488533240.zip ``` Thanks
Author
Owner

@lunny commented on GitHub (Mar 3, 2017):

@cez81 Yes. Except especially critical situation, we will fire an issue to the original library and wait the upstream library update.

@lunny commented on GitHub (Mar 3, 2017): @cez81 Yes. Except especially critical situation, we will fire an issue to the original library and wait the upstream library update.
Author
Owner

@bkcsoft commented on GitHub (Apr 18, 2017):

@lunny As a work-around we could set TMPDIR if it isn't already set?

if os.Getenv("TMPDIR") == "" {
  os.Setenv("TMPDIR", tmpDir)
}
@bkcsoft commented on GitHub (Apr 18, 2017): @lunny As a work-around we could set `TMPDIR` if it isn't already set? ```go if os.Getenv("TMPDIR") == "" { os.Setenv("TMPDIR", tmpDir) } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#416