Default filename for screenshots is problematic

Bug #1054808 reported by Alan Pope 🍺🐧🐱 🦄
130
This bug affects 29 people
Affects Status Importance Assigned to Milestone
Gnome Screenshot
Fix Released
Low
gnome-screenshot (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Press "printscreen" and you'll get a default filename of:-

"Screenshot from YYYY-MM-DD HH:MM:SS.png"

Fine for browsing in nautilus and double clicking on, but this format (specifically the colons) has been a bane for me for some time.

1.
Tab completion fails:-
-rw-rw-r-- 1 alan alan 751K Sep 23 01:10 Screenshot from 2012-09-23 01:10:33.png

# tab completion works as far as here
alan@deep-thought:~/Pictures$ scp Screenshot\ from\ 2012-09-2
Screenshot\ from\ 2012-09-21\ 19\:40\:46.png
Screenshot\ from\ 2012-09-23\ 01\:01\:41.png
Screenshot\ from\ 2012-09-23\ 01\:10\:33.png

# get to here and it won't finish the filename off.
alan@deep-thought:~/Pictures$ scp Screenshot\ from\ 2012-09-23\ 01\:

2. scp fails.
alan@deep-thought:~/Pictures$ scp Screenshot\ from\ 2012-09-23\ 01\:10\:33.png popey.com:
ssh: Could not resolve hostname Screenshot from 2012-09-23 01: Name or service not known

3. Ubuntu one file link in thunderbird fails
See bug 1054803

Whilst I can see an argument for fixing the bugs in all those other applications, wouldn't it make more sense to just not have mad filenames created in the first place.

I propose:-

"Screenshot_from_YYYY-MM-DD_HH-MM-SS.png"

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: gnome-screenshot 3.4.1-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-31.50-generic 3.2.28
Uname: Linux 3.2.0-31-generic x86_64
ApportVersion: 2.0.1-0ubuntu13
Architecture: amd64
Date: Sun Sep 23 01:15:27 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
SourcePackage: gnome-screenshot
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-screenshot (Ubuntu):
status: New → Confirmed
Revision history for this message
Iain Lane (laney) wrote :

This should be fixed upstream rather than here. Could you please file it there?

The area to look at is src/screenshot-filename-builder.c, function build_path. The string is localised, so there will be an impact on translations.

Revision history for this message
David Planella (dpm) wrote :

A quick workaround, if the date/time field is translatable, is to provide your own en_GB translation with the underscores.

Revision history for this message
Kevin Ross (sedecim) wrote :

The screenshots also don't update in Dropbox:

https://www.dropbox.com/help/145/en

Changed in gnome-screenshot:
importance: Unknown → Medium
status: Unknown → New
Revision history for this message
MarkJ (marker) wrote :
Revision history for this message
Hai NGUYEN VAN (psaxl) wrote :

I am a regular user of the NTFS-3G driver and for such matter I have linked my picture folder with the one on my Windows' partition for usages on various softwares on both Linux and Windows.

Printing screen with the "printscreen" button is really convenient but becomes questionable when files have names with characters that are not supposed to be handled in Windows such as ":". Thus my Windows partition becomes quickly unreliable and a simple "chkdsk /f" deletes such kind of files...

This is the reason why, it would be interesting for the user to specifiy a regular expression in a configuration file in order to get a customized default screenshot file name.

Thanks,
Hai

Revision history for this message
Tobias Oelgarte (tobias-oelgarte) wrote :

There are also many hosts that don't accept uploads with such file names. So I'm often forced to rename the file manually, before uploading. In older versions it let you at least choose the file name and default folder with an easy dialog. So I'm very disappointed that such an easy, but frequently used feature had become a pain to use.

Revision history for this message
Marco Lackovic (marco-lackovic) wrote :

Definitely the ':' character in the file name was a poor choice. My proposal would be to use "YYYY-MM-DD HH.MM.SS.png", but it would make much more sense to just let the users be able to customize it.

Revision history for this message
MestreLion (mestrelion) wrote :

@David Planella (dpm) #5 : care to elaborate on that translation workaround? Seems like a nice approach, but how exactly can I provide an alternate translation to gnome-screenshot?

Revision history for this message
Michael Mess (michael-michaelmess) wrote :

I would prefer "Screenshot_from_YYYY-MM-DD_HH-MM-SS.png"

Because it does not contain:
* Spaces
* Colons
* Full Stops other than for separating the extention (.png)

Spaces can be annoying, because if you forget quotes around the file name in a shell command, it looks like two files for the shell that do not exist.

Colons are problematic on Windows and other operating systems and therefore not portable.

Full Stops are usually used to separate the file extentions:
For example: .tar.gz is a file which is a .tar file but has then been compressed using gzip.
Using dots for other purposes may irritate for examble file managers which use file extentions for example to autodetect archive files and then offer functionality to look into the archive for these kind of files.

Revision history for this message
Romano Giannetti (romano-giannetti) wrote :

So the minimal fix (remove just the colon):

--- screenshot-filename-builder.c.orig Tue Nov 5 08:15:09 2013
+++ screenshot-filename-builder.c Tue Nov 5 08:17:18 2013
@@ -132,7 +132,7 @@
       GDateTime *d;

       d = g_date_time_new_now_local ();
- origin = g_date_time_format (d, "%Y-%m-%d %H:%M:%S");
+ origin = g_date_time_format (d, "%Y-%m-%d %H-%M-%S");
       g_date_time_unref (d);
     }
   else

I think that given the advantages it should be applied... I too have found that files disappearing when shared via Dropbox with windows machines, for example.

WARNING: not tested, I am on a windows machine right now :-)

Revision history for this message
Romano Giannetti (romano-giannetti) wrote :

And if I read well the source code, while the messages is localized (see just below when the "Screenshot form" text is added), the date-time format is not.

Clearly the best solution would be to make it user-definable (am I hearing the screams of Gnome designers?) but nevertheless I think that the default should be sensible --- and that means generating files that are Windows-compatibles.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Avoid colons in screenshot file names. WARNING: not tested, I am on a windows machine right now :-)" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in gnome-screenshot:
status: New → Invalid
Changed in gnome-screenshot:
importance: Medium → Unknown
status: Invalid → Unknown
Changed in gnome-screenshot:
importance: Unknown → Low
status: Unknown → New
Revision history for this message
Michael Mess (michael-michaelmess) wrote :

Attached modified patch that also avoids spaces in the resulting filename.
Instead of a space an underscore is used.

Revision history for this message
TV (thomasv) wrote :

Please notice that default name is not compatible with default Owncloud client sync configuration client as '\', '/', '<', '>', ':', '"', '|', '?' and '*' are not allowed. Thanks

Revision history for this message
Jeremy Faden (faden) wrote :

There's an ISO8601 standard for representing times, and this should be followed. It looks like from the patch that the patch (2014-05-17) conforms to this standard. I'm happy to see that this is being addressed.

Revision history for this message
Romano Giannetti (romano-giannetti) wrote :

The problem with ISO8601 is that it uses colons ":" to separate hours, minutes and seconds; although ":" are a perfectly valid character for the Unix filesystem, they are not accepted in Windows. So you can't put the screenshot on a NTFS filesystem nor on a shared filesystem (say, Dropbox) with a Windows system.
The fastest solution to this bug is to switch to shutter, BTW.

Revision history for this message
shauncarter (shaun-54au2) wrote :

Having similar problem using samba shares. Using colon in filenames causes a 'file or directory not found' error when saving or copying to a smb:// location.

Changed in gnome-screenshot:
status: New → Fix Released
Revision history for this message
Romano Giannetti (romano-giannetti) wrote :

Ok, now that the upstream pushed it (and added another patch for gnome-settings-daemon at https://bugzilla.gnome.org/show_bug.cgi?id=740520 ) for 3.14, with a bit of luck it will percolate to Ubuntu Gnome in a couple of years ;-).

My suggestion would be to simply ditch the thing and use shutter by default.

Revision history for this message
Verdi R-D (azend) wrote :

Having colons in image file names makes JIRA not upload my screenshots. :(

Since this has already been fixed in upstream, at what point will these changes be merged into Ubuntu and released? I'm open to adding a PPA to make this work.

Thanks for your help!

Revision history for this message
Sebastien Bacher (seb128) wrote :

the issue is fixed in wily/the current version

Changed in gnome-screenshot (Ubuntu):
importance: Undecided → Low
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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