Group :: Som
RPM: audacity
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: 0002-Use-home-directory-for-temp-dir-instead-of-var-tmp-t.patch
Download
Download
From ac1a27f93a4e56f3cc2132dfbb0f0e8b4f88aef5 Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <mikhailnov@altlinux.org>
Date: Sun, 24 Nov 2019 14:08:24 +0300
Subject: [PATCH 2/7] Use home directory for temp dir instead of /var/tmp to
ensure cache consistency.
Change TMPDIR to AUDACITY_TMPDIR because TMPDIR is often set by default (e.g. by pam_mktemp).
It changes session directory from /var/tmp/audacity-$UID to $HOME/.audacity-tmp
This patch originates from NetBSD: http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/audio/audacity/patches/patch-am
---
help/audacity.1 | 32 +++++++++++++++-----------------
src/AudacityApp.cpp | 9 +++++----
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/help/audacity.1 b/help/audacity.1
index 5ef268886..efad22d91 100644
--- a/help/audacity.1
+++ b/help/audacity.1
@@ -73,24 +73,22 @@ set the audacity block size for writing files to disk to nnn bytes
Per user configuration file.
.RE
-.I /var/tmp/audacity\-<user>/
+.I ~/.audacity\-tmp
.RS
-Default location of Audacity's temp directory, where <user> is your
-username. If this location is not suitable (not enough space in
-/var/tmp, for example), you should change the temp directory in
-the Preferences and restart Audacity. Audacity is a disk-based
-editor, so the temp directory is very important: it should always
-be on a fast (local) disk with lots of free space.
-
-Note that older versions of Audacity put the temp directory inside
-of the user's home directory. This is undesirable on many systems,
-and using some directory in /tmp is recommended.
-
-On many modern Linux systems all files in /tmp/ will be deleted
-each time the system boots up, which makes recovering a recording
-that was going on when the system crashed much harder. This is why
-the default is to use a directory in /var/tmp/ which will not
-normally be deleted by the system. Open the Preferences to check.
+
+On ALT Linux Audacity is patched to use $HOME/.audacity-tmp
+to store session data instead of /var/tmp/audacity-$UID, because
+e.g. it allows to save Audacity sessions in BTRFS snapshots of /home
+and so makes restoring from crashes easier and ensures that session
+data is saved in case of system crash.
+
+Session directory can be overriden with environmental variable AUDACITY_TMPDIR.
+Example:
+env AUDACITY_TMPDIR=/tmp audacity
+will result to using /tmp/audacity\-\$USER
+
+You can set it to e.g. /tmp/, using tmpfs will make it work
+faster, but data will be lost on exidental poweroff.
.RE
.SH SEARCH PATH
When looking for plug-ins, help files, localization files, or other
diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp
index 0a368b37d..07e0572a1 100644
--- a/src/AudacityApp.cpp
+++ b/src/AudacityApp.cpp
@@ -1147,16 +1147,17 @@ bool AudacityApp::OnInit()
* The "share" and "share/doc" directories in their install path */
wxString home = wxGetHomeDir();
- wxString envTempDir = wxGetenv(wxT("TMPDIR"));
+ wxString envTempDir = wxGetenv(wxT("AUDACITY_TMPDIR"));
if (!envTempDir.empty()) {
/* On Unix systems, the environment variable TMPDIR may point to
- an unusual path when /tmp and /var/tmp are not desirable. */
+ an unusual path when /tmp and /var/tmp are not desirable.
+ If $AUDACITY_TMPDIR is set, then $AUDACITY_TMPDIR/audacity-$UID is used. */
TempDirectory::SetDefaultTempDir( wxString::Format(
wxT("%s/audacity-%s"), envTempDir, wxGetUserId() ) );
} else {
- /* On Unix systems, the default temp dir is in /var/tmp. */
+ /* On Unix systems, the default temp dir is in ~/.audacity-tmp */
TempDirectory::SetDefaultTempDir( wxString::Format(
- wxT("/var/tmp/audacity-%s"), wxGetUserId() ) );
+ wxT("%s/.audacity-tmp"), home.c_str() ) );
}
// DA: Path env variable.
--
2.31.1