Interrupting (Ctrl-C) jpegtran causes data loss when -outfile points to input file

Bug #1693520 reported by Jani Uusitalo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libjpeg-turbo (Ubuntu)
New
Undecided
Unassigned

Bug Description

For optimizing files in-place with jpegtran, especially from scripts and when dealing with lots of pictures, it's handy to be able to specify input file as -outfile.

But there's a catch:

Steps to reproduce:
0. Have a large JPEG file, or, alternatively, somewhat slow CPU
1. `jpegtran -optimize -copy all -perfect -outfile large.jpg large.jpg`
2. Hit Ctrl-C before the command finishes

Result:
You now have a broken large.jpg with only part, if any, of the image data remaining.

What I expect to happen:
To have large.jpg as it was before I invoked jpegtran.

Workarounds:
Obviously the traditional workaround of specifying an intermediate temporary output file, then replacing the original with the temporary file only once jpegtran has finished.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: libjpeg-turbo-progs 1.4.2-0ubuntu3
ProcVersionSignature: Ubuntu 4.8.0-53.56~16.04.1-generic 4.8.17
Uname: Linux 4.8.0-53-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.6
Architecture: amd64
CurrentDesktop: Unity
Date: Thu May 25 17:16:16 2017
InstallationDate: Installed on 2016-10-13 (224 days ago)
InstallationMedia: Ubuntu-Server 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
SourcePackage: libjpeg-turbo
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Jani Uusitalo (uusijani) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.