public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
@ 2011-11-09 22:25 ` burnus at gcc dot gnu.org
  2012-01-12  8:06 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-09 22:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-09 22:00:33 UTC ---
Another reason for using chmod() directly is that some systems cannot fork but
still offer the function call.

I think the reason that one does the call instead of calling the library
function is that one either needs to restrict the call or that one needs a
fancy parser to support numeric values such as 0777 but also characters such as
a+x for which the full pattern is [ugoa][+-=][rwxXst].


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
  2011-11-09 22:25 ` [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic burnus at gcc dot gnu.org
@ 2012-01-12  8:06 ` burnus at gcc dot gnu.org
  2012-01-12 17:32 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-12  8:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-12 08:04:57 UTC ---
Created attachment 26305
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26305
Incomplete chmod parser

The attached chmod.c implements an incomplete chmod argument parser.
TODO:
- Check for the missing items and what should be supported
- Implement it in libgfortran and document the supported syntax.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
  2011-11-09 22:25 ` [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic burnus at gcc dot gnu.org
  2012-01-12  8:06 ` burnus at gcc dot gnu.org
@ 2012-01-12 17:32 ` burnus at gcc dot gnu.org
  2012-01-12 19:26 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-12 17:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26305|0                           |1
        is obsolete|                            |

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-12 17:31:37 UTC ---
Created attachment 26307
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26307
Improved version: POSIXly correct chmod as separate program

Attached: A "chmod" program, which takes a string and a file name and should
act as a POSIX chmod program would do. Thus, it honors the "umask", allows for
fancy combinations such as "g+w-r,a+x,-w,o=u,u+s,+t".

TODO:
- Convert this into libgfortran/intrinsic/chmod.c
- Write a fancy documentation for
http://gcc.gnu.org/onlinedocs/gfortran/CHMOD.html which actually describes
which modes are supported - and stats that the mode argument is in line with
the "chmod utility" of POSIX (IEEE Std 1003.1-2001).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-01-12 17:32 ` burnus at gcc dot gnu.org
@ 2012-01-12 19:26 ` burnus at gcc dot gnu.org
  2012-01-12 20:28 ` burnus at gcc dot gnu.org
  2012-01-12 20:33 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-12 19:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |burnus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-12 19:25:31 UTC ---
(In reply to comment #8)
> It honors the "umask", allows for fancy combinations such as
> "g+w-r,a+x,-w,o=u,u+s,+t".

Seemingly, I misread POSIX: For my program o=u sets "other" to the original
permissions. By contrast, GNU chmod sets it to the last permission. For:
  umask 022; mkdir foo; chmod g+w-r,a+x,-w,o=u foo
the difference is whether other is r-x or rwx. In the code: Simply replace
"old_mode" by "file_mode".

I have meanwhile also converted the fixed program into a libgfortran patch:
http://gcc.gnu.org/ml/fortran/2012-01/msg00126.html


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-01-12 19:26 ` burnus at gcc dot gnu.org
@ 2012-01-12 20:28 ` burnus at gcc dot gnu.org
  2012-01-12 20:33 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-12 20:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-12 20:26:18 UTC ---
Author: burnus
Date: Thu Jan 12 20:26:10 2012
New Revision: 183137

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183137
Log:
2012-01-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36755
        * intrinsic.texi (CHMOD): Extend a bit and remove statement
        that /bin/chmod is called.

2012-01-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36755
        * intrinsics/chmod.c (chmod_func): Replace call to /bin/chmod


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.texi
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/chmod.c


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
       [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-01-12 20:28 ` burnus at gcc dot gnu.org
@ 2012-01-12 20:33 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-12 20:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-12 20:29:19 UTC ---
FIXED on the 4.7 trunk.

Thanks HJ for the report!


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
                   ` (5 preceding siblings ...)
  2008-07-09 21:25 ` hjl dot tools at gmail dot com
@ 2008-09-28  0:03 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-09-28  0:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-28 00:02:17
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
                   ` (4 preceding siblings ...)
  2008-07-09 21:22 ` hjl dot tools at gmail dot com
@ 2008-07-09 21:25 ` hjl dot tools at gmail dot com
  2008-09-28  0:03 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-09 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2008-07-09 21:24 -------
Here is one working implementation:

http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/posix/system.c?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=glibc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  2008-07-09 21:18 ` hjl dot tools at gmail dot com
@ 2008-07-09 21:22 ` hjl dot tools at gmail dot com
  2008-07-09 21:25 ` hjl dot tools at gmail dot com
  2008-09-28  0:03 ` steven at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-09 21:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |minor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2008-07-09 20:49 ` pinskia at gcc dot gnu dot org
@ 2008-07-09 21:18 ` hjl dot tools at gmail dot com
  2008-07-09 21:22 ` hjl dot tools at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-09 21:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl dot tools at gmail dot com  2008-07-09 21:18 -------
(In reply to comment #3)
> > The current fork/exec implementation is incorrect.
> 
> How is it incorrect?  Since file could have spaces in it, using system is not
> useful at all and even harder to do the correct thing.  Really it does not use
> system because creating a string to use with system makes it even more
> incorrect than it is currently.
> 

It should handle signal and check return from wait to match pid.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
  2008-07-07 21:01 ` [Bug libfortran/36755] " pinskia at gcc dot gnu dot org
  2008-07-09 20:35 ` hjl dot tools at gmail dot com
@ 2008-07-09 20:49 ` pinskia at gcc dot gnu dot org
  2008-07-09 21:18 ` hjl dot tools at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-09 20:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-07-09 20:48 -------
> The current fork/exec implementation is incorrect.

How is it incorrect?  Since file could have spaces in it, using system is not
useful at all and even harder to do the correct thing.  Really it does not use
system because creating a string to use with system makes it even more
incorrect than it is currently.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
  2008-07-07 21:01 ` [Bug libfortran/36755] " pinskia at gcc dot gnu dot org
@ 2008-07-09 20:35 ` hjl dot tools at gmail dot com
  2008-07-09 20:49 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-09 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2008-07-09 20:34 -------
The current fork/exec implementation is incorrect. Basically, it
re-implements system (). It is tricky to get it 100% correct. One
can take a look at system () source to see it him/herself.  I think
we should call chmod directly, rather than fix fork/exec.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic
  2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
@ 2008-07-07 21:01 ` pinskia at gcc dot gnu dot org
  2008-07-09 20:35 ` hjl dot tools at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-07-07 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-07-07 21:00 -------
Why is really an issue anyways? chmod should not be used too much anyways. 


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36755


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-01-12 20:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-36755-4@http.gcc.gnu.org/bugzilla/>
2011-11-09 22:25 ` [Bug libfortran/36755] Avoid fork/exec in chmod intrinsic burnus at gcc dot gnu.org
2012-01-12  8:06 ` burnus at gcc dot gnu.org
2012-01-12 17:32 ` burnus at gcc dot gnu.org
2012-01-12 19:26 ` burnus at gcc dot gnu.org
2012-01-12 20:28 ` burnus at gcc dot gnu.org
2012-01-12 20:33 ` burnus at gcc dot gnu.org
2008-07-07 20:58 [Bug libfortran/36755] New: " hjl dot tools at gmail dot com
2008-07-07 21:01 ` [Bug libfortran/36755] " pinskia at gcc dot gnu dot org
2008-07-09 20:35 ` hjl dot tools at gmail dot com
2008-07-09 20:49 ` pinskia at gcc dot gnu dot org
2008-07-09 21:18 ` hjl dot tools at gmail dot com
2008-07-09 21:22 ` hjl dot tools at gmail dot com
2008-07-09 21:25 ` hjl dot tools at gmail dot com
2008-09-28  0:03 ` steven at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).