Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^6: File permissions problem (updated)

by wdhammond (Novice)
on Dec 16, 2016 at 15:45 UTC ( [id://1177927]=note: print w/replies, xml ) Need Help??


in reply to Re^5: File permissions problem (updated)
in thread File permissions problem

Hi Hauke,

Sorry about the delay in responding, lost this response. I need to respond linearly to the comments.

The response to umask command is 0002 which gives file permissions 0664. I should have looked at the permissions before responding instead of relying on my memory.:)

There is a section that appears similar to your possible fix:

# Custom file save routine to handle unicode files sub SaveUTF { my ( $w, $filename ) = @_; $filename = $w->FileName unless defined $filename; my $dir = dirname($filename); my $perms = ( stat($dir) )[2] & 07777; unless ( $perms & 0200 ) { $perms = $perms | 0200; chmod $perms, $dir or $w->BackTrace("Can not write to directory $dir: $!\n") and return; }
Regards, Wayne

Replies are listed 'Best First'.
Re^7: File permissions problem (updated)
by haukex (Archbishop) on Dec 16, 2016 at 16:06 UTC

    Hi Wayne,

    PerlMonks is more of a place to learn Perl, and not usually a place where people do others' work for free - unless a monk happens to be interested, but that's not always the case, especially the more freebies one asks for ;-) If you're planning on fixing more bugs in the code, the best way to go would be to pick up at least a little bit of Perl yourself. perlintro is a good place to start, as well as Tutorials and learn.perl.org. Anyway, having said that...

    Disclaimer: I don't know the rest of the "guiguts" code, so I don't know if the following will fix the issue 100% or if there will be any negative side effects on other parts of the code.

    I'd try to hack the fix by adding the line chmod(0666&~umask,$filename) or warn "Couldn't chmod $filename"; after the line if ( rename( $tempfilename, $filename ) ) { (untested).

    BTW, it'd be best to mention the existing bug report: https://sourceforge.net/p/guiguts/bugs/133/

    Regards,
    -- Hauke D

      Thank you for all of your help Hauke.

      The "bug report" was created by me but is not getting much attention so I am trying to correct my copy of the application to make my job easier. Mostly I have been formatting out of copyright books for Project Gutenberg. I am working on learning Perl too. Thanks too for the links.

      Regards, Wayne

        Hi Wayne,

        The last commit on the Guiguts repository was a little over three years ago. If I were in your place, I might fork the repository, for example on GitHub, and start making my commits there (an excellent resource on learning Git is the Git Book). That way, changes would be public and other users could benefit from them, and if the developers are still active, they could pull selected changes back into their code.

        You don't need to know a ton of Perl for basic debugging tasks - a lot of my debugging needs are covered by Data::Dump, e.g. use Data::Dump 'pp'; and then at strategic places pp $variable;. What might also be helpful is use Carp 'cluck';, then cluck "test"; will give you stack traces. And as you begin to understand more and more Perl, that will help in posting better questions, such as locating the source of problems by boiling the code down to the minimum needed for others to be able to reproduce the problem.

        Of course we're happy to help, and if I made it sound too much like you already need to know Perl before asking questions here, that's not the case - you should have the willingness to learn Perl :-)

        Regards,
        -- Hauke D

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1177927]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-18 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found