Gitea: Cannot change tmp directory when dumping

Created on 2 Mar 2017  路  6Comments  路  Source: go-gitea/gitea

  • 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

kinenhancement

Most helpful comment

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

if os.Getenv("TMPDIR") == "" {
  os.Setenv("TMPDIR", tmpDir)
}

All 6 comments

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

@lunny I can have a look at this one.

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?

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

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

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

if os.Getenv("TMPDIR") == "" {
  os.Setenv("TMPDIR", tmpDir)
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fastidious picture Fastidious  路  3Comments

tuxfanou picture tuxfanou  路  3Comments

BNolet picture BNolet  路  3Comments

lunny picture lunny  路  3Comments

jorise7 picture jorise7  路  3Comments