Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2001 01:07:06 -0800 (PST)
From:      Alan Eldridge <alane@geeksrus.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/31629: kdelibs2(2.2.1): Konq-SaveImageAs.. produces warning about can't set permissions ...
Message-ID:  <200110300907.f9U976W12755@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         31629
>Category:       ports
>Synopsis:       kdelibs2(2.2.1): Konq-SaveImageAs.. produces warning about can't set permissions ...
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 30 01:10:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alan Eldridge
>Release:        4.4-RELEASE
>Organization:
>Environment:
FreeBSD wwweasel.geeksrus.net 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Sun Oct 28 04:44:34 EST 2001     root@wwweasel.geeksrus.net:/usr/src-4.4-RELEASE/sys/compile/WWWEASEL  i386

>Description:
If you use "Save Image As..." to save a graphic in Konqueror[1], if the saved file doesn't exist prior to this, a warning box is produced that tells you that "can't set permissions on [file you just saved]".

[1]This is a general error, though. Any KIO::copy(), KIO::copyAs(), etc call will provoke this when creating a new file. It's just most obvious in Konq. Precondition is that the image you are saving is NOT in the cache, and the target file does not already exist.	S
>How-To-Repeat:
Go to any web site. Use "save image as..." from right-button menu.
Make sure you're creating a new file.

>Fix:
In job.cpp, the KIO::copy() results in a CopyJob object, which, in its copyNextFile() method, creates a FileCopyJob object. (still with me?)

A permission value of -1 used throughout the KIO* code to indicate that we don't want any special perms.

A mode_t (uint16_t) is used to hold the perms to pass to the FileCopyJob. This results in passing 0x0000ffff, *NOT* -1 (0xffffffff), as the perms. When, in kio/file/file.cc, in another process no less, we check for -1, it fails, so we try to chmod the newly created file to perms 17777777. chmod(2) doesn't like those bits for a file.

Fix: change mode_t to int, and change (mode_t)-1 to -1 when the FileCopyJob is being set up.

[alane@wwweasel /usr/ports/x11/kdelibs2/files]$ cat patch-CopyJob\:\:copyNextFile-int_perms
--- kio/job.cpp.or      Fri Sep  7 15:20:14 2001
+++ kio/job.cpp Tue Oct 30 03:46:45 2001
@@ -2463,7 +2463,7 @@
             // But for files coming from TAR, we want to preserve permissions -> we use default perms only if from remote
             // The real fix would be KProtocolInfo::inputType(protocol) == T_FILESYSTEM, but we can't access ksycoca from here !
             bool remoteSource = !(*it).uSource.isLocalFile() && ((*it).uSource.protocol() != "tar"); // HACK
-            mode_t permissions = ( remoteSource && (*it).uDest.isLocalFile() )
? (mode_t)-1 : (*it).permissions;
+            int permissions = ( remoteSource && (*it).uDest.isLocalFile() ) ? -1 : (*it).permissions;
             KIO::FileCopyJob * copyJob = KIO::file_copy( (*it).uSource, (*it).uDest, permissions, bOverwrite, false, false/*no GUI*/ );
             copyJob->setSourceSize( (*it).size );
             newjob = copyJob;
[alane@wwweasel /usr/ports/x11/kdelibs2/files]$






>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110300907.f9U976W12755>