Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Hi

I've just fixed a grave bug #770721 (Deletes existing "file.tex" when
"texstudio file" executed) which caused data loss.

When texstudio is called from command line with "texstudio some", it
automatically appends a file extension (e.g. .tex) and silently saves
the new empty file as "some.tex" (instead of "some") resulting in data
loss if a file called "some.tex" already existed.

The bug has actually been correctly fixed upstream
(https://sourceforge.net/p/texstudio/hg/ci/3ddd22751dac0beadcf2aea3518dc0461633b5d2/)
but somehow ended up broken/incomplete in the source tar.gz.

If the release team is ok with the changes, I'll upload version
2.8.4+debian-3 as follows:

texstudio (2.8.4+debian-3) unstable; urgency=medium

  * Adding 06-fix-silent-file-saving.patch in order to prevent data loss
    (Closes: #770721).

 -- Tom Jampen <t...@cryptography.ch>  Wed, 03 Dec 2014 14:05:12 +0200

Thanks
Tom
diff -Nru texstudio-2.8.4+debian/debian/changelog 
texstudio-2.8.4+debian/debian/changelog
--- texstudio-2.8.4+debian/debian/changelog     2014-11-06 14:45:35.000000000 
+0100
+++ texstudio-2.8.4+debian/debian/changelog     2014-12-03 14:06:05.000000000 
+0100
@@ -1,3 +1,10 @@
+texstudio (2.8.4+debian-3) unstable; urgency=medium
+
+  * Adding 06-fix-silent-file-saving.patch in order to prevent data loss
+    (Closes: #770721).
+
+ -- Tom Jampen <t...@cryptography.ch>  Wed, 03 Dec 2014 14:05:12 +0200
+
 texstudio (2.8.4+debian-2) unstable; urgency=medium
 
   * Updating to standards version 3.9.6, no changes needed.
diff -Nru texstudio-2.8.4+debian/debian/patches/06-fix-silent-file-saving.patch 
texstudio-2.8.4+debian/debian/patches/06-fix-silent-file-saving.patch
--- texstudio-2.8.4+debian/debian/patches/06-fix-silent-file-saving.patch       
1970-01-01 01:00:00.000000000 +0100
+++ texstudio-2.8.4+debian/debian/patches/06-fix-silent-file-saving.patch       
2014-12-03 13:55:20.000000000 +0100
@@ -0,0 +1,43 @@
+Author: Tom Jampen <t...@cryptography.ch>
+Description:
+ Fixing a bug that caused texstudio to append a file extension based on the
+ current selectedFileFilter even if a 'silent save' is performed. This
+ resulted in data loss in the case a file with the file extension was
+ already present.
+
+diff -Naurp a/texmaker.cpp b/texmaker.cpp
+--- a/texmaker.cpp     2014-12-03 13:27:44.039587135 +0100
++++ b/texmaker.cpp     2014-12-03 13:39:15.605830640 +0100
+@@ -2279,18 +2279,21 @@ void Texmaker::fileSaveAs(const QString&
+       }
+       
+       // get a file name
+-    QString fn =fileName;
+-    if(!saveSilently || fn.isEmpty())
+-        fn = QFileDialog::getSaveFileName(this,tr("Save 
As"),currentDir,fileFilters, &selectedFileFilter);
+-      if (!fn.isEmpty()) {
+-              static QRegExp fileExt("\\*(\\.[^ )]+)");
+-              if (fileExt.indexIn(selectedFileFilter) > -1) {
+-                      //add
+-                      int 
lastsep=qMax(fn.lastIndexOf("/"),fn.lastIndexOf("\\"));
+-                      int lastpoint=fn.lastIndexOf(".");
+-                      if (lastpoint <= lastsep) //if both aren't found or 
point is in directory name
+-                              fn.append(fileExt.cap(1));
++      QString fn =fileName;
++      if(!saveSilently || fn.isEmpty()) {
++              fn = QFileDialog::getSaveFileName(this,tr("Save 
As"),currentDir,fileFilters, &selectedFileFilter);
++              if (!fn.isEmpty()) {
++                      static QRegExp fileExt("\\*(\\.[^ )]+)");
++                      if (fileExt.indexIn(selectedFileFilter) > -1) {
++                              //add
++                              int 
lastsep=qMax(fn.lastIndexOf("/"),fn.lastIndexOf("\\"));
++                              int lastpoint=fn.lastIndexOf(".");
++                              if (lastpoint <= lastsep) //if both aren't 
found or point is in directory name
++                                      fn.append(fileExt.cap(1));
++                      }
+               }
++      }
++      if (!fn.isEmpty()) {
+               if (getEditorViewFromFileName(fn) && 
getEditorViewFromFileName(fn) != currentEditorView()) {
+                       // trying to save with same name as another already 
existing file
+                       LatexEditorView *otherEdView = 
getEditorViewFromFileName(fn);
diff -Nru texstudio-2.8.4+debian/debian/patches/series 
texstudio-2.8.4+debian/debian/patches/series
--- texstudio-2.8.4+debian/debian/patches/series        2014-09-10 
06:51:30.000000000 +0200
+++ texstudio-2.8.4+debian/debian/patches/series        2014-12-03 
14:31:35.000000000 +0100
@@ -3,3 +3,4 @@
 03-disable-auto-update.patch
 04-no-qt-translations.patch
 05-use-libsynctex.patch
+06-fix-silent-file-saving.patch

Reply via email to