After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 161525 - Screenshot application complains that it cannot save the screenshot file
Screenshot application complains that it cannot save the screenshot file
Status: RESOLVED FIXED
Product: gnome-utils
Classification: Deprecated
Component: screenshot
2.9.x
Other FreeBSD
: High blocker
: ---
Assigned To: Jonathan Blandford
gnome-utils Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-12-17 06:38 UTC by Joe Marcus Clarke
Modified: 2006-12-22 12:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Allow screenshot application to save screenshots (347 bytes, patch)
2004-12-17 06:39 UTC, Joe Marcus Clarke
none Details | Review
Quick patch to check errors. (1.35 KB, patch)
2004-12-17 21:45 UTC, Jonathan Blandford
none Details | Review

Description Joe Marcus Clarke 2004-12-17 06:38:47 UTC
When one tries to capture a screenshot under GNOME 2.9, the following error is
thrown:

Unable to save the screenshot to disk:
        (null)

I looked at the code in gnome-utils, and I think there is a logic bug.  The
attached patch corrects the problem, and seems pretty correct to me.
Comment 1 Joe Marcus Clarke 2004-12-17 06:39:30 UTC
Created attachment 34928 [details] [review]
Allow screenshot application to save screenshots
Comment 2 Jonathan Blandford 2004-12-17 19:10:04 UTC
That patch doesn't make sense to me.  If we have an error message on the pipe,
then we have an error.  We assume that a save occurred iff the pipe just closes.
 Can you see what the error is by putting a print statement near the write() on
line 184?
Comment 3 Joe Marcus Clarke 2004-12-17 20:10:51 UTC
That's just it, nothing is written to that pipe.  However, G_IO_IN is being set
when pipe_from_child[1] is closed.  If read_pipe_from_child() is changed so as
not to display the dialog and exit if error_message is NULL, then
gnome-screenshot will work again.

Alternatively, since G_IO_HUP is also set when the pipe is closed, the code
could also be modified to check to see if G_IO_HUP and G_IO_IN are set, and if
so, then don't print the error dialog and exit.
Comment 4 Jonathan Blandford 2004-12-17 21:44:00 UTC
Why is G_IO_IN set there?  I'm not getting that here, just the HUP.  I'll double
check on Monday why it's set, but in the interim here's a patch that checks the
result of g_io_channel_read_line().  It should hopefully fix the problem you had.  

This is on freebsd, right?
Comment 5 Jonathan Blandford 2004-12-17 21:45:02 UTC
Created attachment 34949 [details] [review]
Quick patch to check errors.
Comment 6 Joe Marcus Clarke 2004-12-17 21:47:09 UTC
Yeah, this is on FreeBSD 5-STABLE with glib-2.5.7.  I haven't updated to 2.6.0
yet on this machine.
Comment 7 Luis Villa 2005-01-03 04:30:25 UTC
So is the patch committed?
Comment 8 Jonathan Blandford 2005-01-03 16:42:07 UTC
not yet.  I didn't get to it over Xmas as it merged with a larger patch of mine.
 I'll try to it this week.
Comment 9 Joe Marcus Clarke 2005-01-03 18:38:11 UTC
Note: I did some more testing with this since gnome-nettool had a similar
problem.  All BSDs set POLLIN along with POLLHUP on a pipe EOF.  MacOS X doesn't
set POLLHUP on EOF, but rather just POLLIN, and read() will return 0 to indicate
EOF.

Therefore, all G_IO_IN tests should probably check for EOF, and cleanup
appropriately.
Comment 10 Jonathan Blandford 2005-01-03 20:00:53 UTC
Prolly should update the glib docs to reflect this.
Comment 11 Khasim Shaheed 2005-01-06 06:29:09 UTC
This is working fine for me with the latest version of screenshot 2.9.4 and the
version of GNOME i am using is 2.9(cvs head) built on 3rd Jan 2005.

The Operating System i am using is Novell Linux Desktop.
Comment 12 Joe Marcus Clarke 2005-01-06 06:54:58 UTC
Linux and Solaris are not affected by this.  Only *BSD and MacOS X will be affected.
Comment 13 Vincent Noel 2005-03-07 18:18:40 UTC
Now that gnome-utils has branched for 2.10, I hope the larger patch can be
committed ;-)
Comment 14 Tino Meinen 2006-01-16 14:29:49 UTC
maybe gnome bugzilla bug #325708 is related to this?
http://bugzilla.gnome.org/show_bug.cgi?id=325708
Comment 15 Emmanuele Bassi (:ebassi) 2006-01-22 18:02:26 UTC
tino (comment #14): nope, this bug affects *BSD.

jrb: was the patch committed? can we close this bug?
Comment 16 André Klapper 2006-08-24 14:19:20 UTC
jonathan, joe, what's the state of this?
patch has not been committed to CVS it seems - can this get in?
Comment 17 Joe Marcus Clarke 2006-08-24 15:09:58 UTC
I am still using this patch in our local ports repository.  I would like to see it committed, but I have no say in that.
Comment 18 xerxas 2006-12-20 21:34:40 UTC
Something new on this ?
I still see this issue.
Comment 19 danny goulder 2006-12-21 10:51:29 UTC
Ditto I am seeing this issue also

Running Gnome 2.16 on Gentoo Linux x86 (stable)

seems this bug's pervading other archs...

where do I find the patch to see if it fixes the problem here?
Comment 20 Mikael Hermansson 2006-12-22 00:37:21 UTC
the  problem is also on  on my ubuntu (linux 2.6.19) box since atleast gnome-utils 2.17

The read_pipe_from_child() calls: 

g_io_channel_read_line() and it returns G_IO_STATUS_EOF  on linux too as far as I can see it does not send a IO_HUP at all.

the read_pipe_from_child() is called after close opertion on the child filedescriptor (screenshot-save.c:206)


I dont know why this has worked before because it is a bug.

check the return status of g_io_channel_read_line() should fix the problem.



Comment 21 André Klapper 2006-12-22 01:17:40 UTC
danny, the patch is attached here at comment #5:
http://bugzilla.gnome.org/attachment.cgi?id=34949
Comment 22 Matti Lindell 2006-12-22 11:30:11 UTC
For what is worth, patch attached on Comment #5 fixed the issue for me too. Using gnome-utils 2.17.
Comment 23 danny goulder 2006-12-22 12:18:53 UTC
quick patch from comment #5 also worked for me on gnome-utils 2.16.2

cheers

danny
Comment 24 Emmanuele Bassi (:ebassi) 2006-12-22 12:33:33 UTC
thanks to all BSDers who tested the patch.

should be fixed in HEAD; if my calendar is right, there should be a 2.16 point release in january: will backport the patch to gnome-2-16.
Comment 25 Emmanuele Bassi (:ebassi) 2006-12-22 12:42:25 UTC
committed to gnome-2-16, hence closing as FIXED.