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 152127 - Panel accepts named pipe as background image.
Panel accepts named pipe as background image.
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: panel
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Panel Maintainers
Panel Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-09-08 03:50 UTC by Vasista Sarma
Modified: 2004-12-30 21:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed Patch (2.00 KB, patch)
2004-09-08 03:52 UTC, Vasista Sarma
none Details | Review
Modified Patch (975 bytes, patch)
2004-09-29 10:12 UTC, Vasista Sarma
none Details | Review

Description Vasista Sarma 2004-09-08 03:50:17 UTC
Description of Problem: 
Panels accept named pipes as background images. They block trying to 
open the pipe, but on providing data by cat'ing an image file into the 
pipe, the panel load completes but the background does not change. 
 
Steps to reproduce the problem: 
1. Right click on panel and choose 'Properties' 
2. Click on tab 'Background' 
3. Select 'Background Image' 
4. Type in a path name say '/home/picture-pipe' 
5. Click on 'Close' 
6. Right click on desktop and choose 'Open Terminal' 
7. Run command 'cd /home/; mkfifo picture-pipe' 
8. Use 'GIMP' or other graphics app to create any image file, say foo.png 
9. Logout and Login again 
10. Panel does not load. It blocks waiting for data on the pipe. 
11. Switch to console, "CTRL+ALT+F1" 
12. Login and run the command "cat foo.png > picture-pipe" 
13. Switch back to desktop, "CTRL+ALT+F7" 
14. The panel unblocks and hence loads up. 
 
Actual Results: 
The panel loads, but the background color is not changed to that of 
foo.png 
 
Expected Results: 
Either: 
    The panel should refuse to accept special files as background images. 
Or: 
    The panel should change it's background color after reading the pipe. 
 
How often does this happen?  
Always 
 
Additional Information:
Comment 1 Vasista Sarma 2004-09-08 03:52:42 UTC
Created attachment 31403 [details] [review]
Proposed Patch
Comment 2 Vasista Sarma 2004-09-08 04:06:51 UTC
There is another problem which is very closely related to this 
particular bug. 
Description of the problem: 
Panel properties dialog does not wait for the user to complete 
the typing of a background image file name. Every keystroke is  
analyzed and the first matching filename is accepted.  
 
Steps to reproduce the problem: 
1. Have an image file in the home directory and rename it as  
   data_pic.png ( or any other extension like gif, jpeg etc ) 
2. Right click on desktop and choose 'Open Terminal' 
3. Run command 'cd ~ ; mkfifo data' 
4. Right click on Panel and choose 'Properties'. Click on the  
   'Background' tab. 
5. Select 'Background image' 
6. Type the path of the image file i.e /home/user/data_pic.png in the 
   entry provided. 
 
Actual Results: 
The user would not be able to type the full filename. After the user 
types 'data', the panel would block since it accepts 'data', the 
named pipe, as an image. 
 
Expected Results: 
Panel 'Properties' dialog should wait until the user completes the 
input. The changes should be accepted and , if possible, verified 
only after the user clicks on 'Close'. 
 
How often does this happen?  
Always 
 
The above patch takes care of this problem as well 
Comment 3 Vijaykumar Patwari 2004-09-10 10:30:28 UTC
 static void
 load_background_file (PanelBackground *background)
 {
-       GError *error = NULL;
-
+               GError *error = NULL;
+               struct stat buf;
+               gint ret;



+               if(!(ret=stat(background->image,&buf)))
+               {
+                       if (S_ISREG(buf.st_mode))

You may want to use g_file_test(), check if G_FILE_TEST_EXISTS and
G_FILE_TEST_IS_REGULAR.  


+                       {
+                       background->loaded_image = 
+                       gdk_pixbuf_new_from_file (background->image, &error);

------- Additional Comment #2 From Vasista Sarma 2004-09-08 00:06 ------- 

  The user would not be able to type the full filename. After the user 
  types 'data', the panel would block since it accepts 'data', the 
  named pipe, as an image.

Yeah, its an instant apply dialog :-)


what happens if there's was an previous image set?. It gets lost right?.
Comment 4 Vasista Sarma 2004-09-29 10:12:41 UTC
Created attachment 32061 [details] [review]
Modified Patch

Modified Patch Checks if the file exists and is regular then applies it to
background
Comment 5 Vincent Untz 2004-12-30 21:50:19 UTC
Thanks for the patch. It's in HEAD.