pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problem on test perlu trigger function.
3+ messages / 2 participants
[nested] [flat]

* problem on test perlu trigger function.
@ 2009-09-05 05:18  Piaff33z <piaff33z@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Piaff33z @ 2009-09-05 05:18 UTC (permalink / raw)
  To: pgsql-interfaces

Hello,

I have a problem on a test directory on my trigger function.
For information, i use a 8.0.21 version of perl.

To make things simple, i make a perlu function trigger on when i modify 
a row, i try to test the existence of a directory. I have the impression 
that this test
does not work :-(

my function...

..
if (! -d  "$PATHBASE/$_TD->{new}{categorie}") {
          `sudo -u http mkdir "$PATHBASE/$_TD->{new}{categorie}"`;
       }
...

Sudo function is performed in spite of the presence of directory ! It as 
if  "-d" serve has nothing...

Anybody knows why?

Vic




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

* Re: problem on test perlu trigger function.
@ 2009-09-05 11:30  Greg Sabino Mullane <greg@turnstep.com>
  parent: Piaff33z <piaff33z@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Greg Sabino Mullane @ 2009-09-05 11:30 UTC (permalink / raw)
  To: pgsql-interfaces


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> if (! -d  "$PATHBASE/$_TD->{new}{categorie}") {
>          `sudo -u http mkdir "$PATHBASE/$_TD->{new}{categorie}"`;
>       }

> Sudo function is performed in spite of the presence of directory ! It as
> if  "-d" serve has nothing...
>
> Anybody knows why?

Because the directory is created and owned by the http user, but is not
visible to the process that runs this function (postgres). One solution
would be to skip the test and call mkdir -p. Another would be to set
the permissions so that the postgres user can see the directories
inside of $PATHBASE.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200909050729
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkqiS88ACgkQvJuQZxSWSshetgCbB3ao2kGembYXswSu7fQ77NFH
4lEAoMfBRsbbNMg4g8wSgIJ6iE+mhFHC
=esTM
-----END PGP SIGNATURE-----





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

* Re: problem on test perlu trigger function.
@ 2009-09-05 17:53  Piaff33z <piaff33z@gmail.com>
  parent: Greg Sabino Mullane <greg@turnstep.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Piaff33z @ 2009-09-05 17:53 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: Greg Sabino Mullane <greg@turnstep.com>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<span class="moz-smiley-s6"><span> :-[&nbsp;&nbsp; </span></span> I am stupid,
it is obvious !<br>
<br>
Really you are right <span class="moz-smiley-s5"><span> :-D </span></span>,
script is thrown with the rights of account
postgres and it does not have the rights to browse this directory ...<br>
Your proposal of the "mkdir -p" seems to me the better solution !<br>
<br>
Still thank you for this analysis !<br>
<br>
However, i have an other problem and I am going to open new thread. And
that there seems to me a little more crooked...<br>
<br>
Vic &nbsp;&nbsp;<span class="moz-smiley-s1"><span> :-) </span></span><br>
<br>
Greg Sabino Mullane a &eacute;crit&nbsp;:
<blockquote cite="mid:6f8c66fd5a3c12667eff14d54a398d70@biglumber.com"
 type="cite">
  <pre wrap="">-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


  </pre>
  <blockquote type="cite">
    <pre wrap="">if (! -d  "$PATHBASE/$_TD-&gt;{new}{categorie}") {
         `sudo -u http mkdir "$PATHBASE/$_TD-&gt;{new}{categorie}"`;
      }
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">Sudo function is performed in spite of the presence of directory ! It as
if  "-d" serve has nothing...

Anybody knows why?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Because the directory is created and owned by the http user, but is not
visible to the process that runs this function (postgres). One solution
would be to skip the test and call mkdir -p. Another would be to set
the permissions so that the postgres user can see the directories
inside of $PATHBASE.

- --
Greg Sabino Mullane <a class="moz-txt-link-abbreviated" href="mailto:greg@turnstep.com">greg@turnstep.com</a>
End Point Corporation
PGP Key: 0x14964AC8 200909050729
<a class="moz-txt-link-freetext" href="http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8">http://biglumber.com/...;
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkqiS88ACgkQvJuQZxSWSshetgCbB3ao2kGembYXswSu7fQ77NFH
4lEAoMfBRsbbNMg4g8wSgIJ6iE+mhFHC
=esTM
-----END PGP SIGNATURE-----



  </pre>
</blockquote>
<br>
</body>
</html>



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


end of thread, other threads:[~2009-09-05 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-09-05 05:18 problem on test perlu trigger function. Piaff33z <piaff33z@gmail.com>
2009-09-05 11:30 ` Greg Sabino Mullane <greg@turnstep.com>
2009-09-05 17:53   ` Piaff33z <piaff33z@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox