Bug 231420 - Pasting an image created on the clipboard with PrintScrn results in wrong file permissions
Summary: Pasting an image created on the clipboard with PrintScrn results in wrong fil...
Status: RESOLVED FIXED
Alias: None
Product: kde
Classification: I don't know
Component: clipboard (show other bugs)
Version: 4.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-20 15:16 UTC by Nikos Chantziaras
Modified: 2011-04-21 01:38 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Chantziaras 2010-03-20 15:16:19 UTC
Version:            (using KDE 4.4.1)
Compiler:          GCC 4.4.3 (Gentoo 4.4.3 p1.0)
OS:                Linux
Installed from:    Gentoo Packages

When I take a screenshot with Ctrl+PrintScrn (or something equivalent, like taking a screenshot of the active window only) and then use Ctrl+V in Dolphin or the Plasma desktop folder in order to save it in a file, the file permissions of the file are wrong:

  $ls -l screenshot.png
  -rw------- 1 realnc users  73K 2010-03-20 16:12

My umask is 022, so actually the new file should have the permissions like this:

  -rw-r--r--

This turns out to be annoying when I paste or scp the image into my web server and people can a "permission denied" error when they try to view it.
Comment 1 Dario Andres 2010-03-20 15:48:08 UTC
- Which application are you using to take the screenshot ? KSnapshot ?
Regards
Comment 2 Nikos Chantziaras 2010-03-20 16:16:54 UTC
(In reply to comment #1)
> - Which application are you using to take the screenshot ? KSnapshot ?
> Regards

No, I'm using the built-in functionality of KDE.  The default shortcut in Ctrl+Print.  I guess it's KWin that takes the screenshot since in the "Global Keyboard Shortcuts" section of System Settings, it's listed as a "KWin" shortcut.
Comment 3 Nikos Chantziaras 2010-04-02 10:15:10 UTC
No one can dedicate 10 seconds of his time to try and reproduce?
Comment 4 Peter Penz 2010-04-02 10:55:53 UTC
I could confirm the issue.
Comment 5 Samuel Brack 2011-01-05 14:50:32 UTC
Confirmed in 4.5, changing component to clipboard.
Comment 6 Nikos Chantziaras 2011-01-05 15:06:08 UTC
Not only 4.5, it's still a problem in 4.6.
Comment 7 Nikos Chantziaras 2011-01-28 14:15:41 UTC
Updated from 4.6 RC2 to 4.6 final.  Issue still there.
Comment 8 Nikos Chantziaras 2011-04-06 23:06:03 UTC
But still there in KDE 4.6.2.
Comment 9 David Faure 2011-04-19 14:18:15 UTC
OK, this is because kio/paste.cpp's pasteDataAsyncTo writes into a tempfile, and then moves the temp file to the final location [so that it works for remote urls too].

Since this creates other issues too (undo moves back to the tempfile!), I think I'll need to rework all this to be a "put job" instead.
Comment 10 David Faure 2011-04-19 22:44:13 UTC
Git commit 2d37dbf9bc4e66611b59aedc2144363aeee5a27f by David Faure.
Committed on 19/04/2011 at 22:44.
Pushed by dfaure into branch 'master'.

Implement pasting of data with storedPut rather than moving a tempfile.

This fixes the wrong permissions on the created file, and will make it
possible to fix undo too (not done yet).

Had to deprecate methods that return a CopyJob pointer, but the main
method pasteClipboard is unchanged.

Old QT_NO_MIMECLIPBOARD code removed, unmaintainable and wrong.

BUG: 231420
FIXED-IN: 4.7

M  +88   -68   kio/kio/paste.cpp     
M  +22   -6    kio/kio/paste.h     

http://commits.kde.org/kdelibs/2d37dbf9bc4e66611b59aedc2144363aeee5a27f
Comment 11 Nikos Chantziaras 2011-04-21 01:00:18 UTC
Thanks, David. Any chance for a fix for 4.6?
Comment 12 David Faure 2011-04-21 01:38:43 UTC
Nope, too intrusive.