From owner-freebsd-ports Tue Oct 30 1:10: 8 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 52EAA37B403 for ; Tue, 30 Oct 2001 01:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9U9A0i13273; Tue, 30 Oct 2001 01:10:00 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6942437B401 for ; Tue, 30 Oct 2001 01:07:06 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9U976W12755; Tue, 30 Oct 2001 01:07:06 -0800 (PST) (envelope-from nobody) Message-Id: <200110300907.f9U976W12755@freefall.freebsd.org> Date: Tue, 30 Oct 2001 01:07:06 -0800 (PST) From: Alan Eldridge To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/31629: kdelibs2(2.2.1): Konq-SaveImageAs.. produces warning about can't set permissions ... Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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