public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin 1.7 message queues - permission denied error still exists
@ 2009-09-13 16:13 Philip Semanchuk
  2009-09-13 16:22 ` Christopher Faylor
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Semanchuk @ 2009-09-13 16:13 UTC (permalink / raw)
  To: cygwin

Hi all,
I'm fooling around with POSIX IPC under Cygwin 1.7 beta and message  
queues still seem to be broken per the description in this thread:
http://www.cygwin.com/ml/cygwin/2008-08/msg00539.html

That thread says that a fix is in "-29" [1]. I'm not sure what version  
I have, but I downloaded my Cygwin 1.7 in August and I see that cygwin- 
dev is discussing 1.7.0-60, so I assume that my Cygwin is sufficiently  
up to date.

Should this bug be fixed, or...? Is there anything I can do to help?

Thanks
Philip

[1] - As a Cygwin n00b, I don't know how to get the cygwin release  
number. I checked the FAQ, but it says, "If you are looking for the  
version number for the whole Cygwin release, there is none." I'd be  
happy to report my release number if someone can clue me in.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still  exists
  2009-09-13 16:13 Cygwin 1.7 message queues - permission denied error still exists Philip Semanchuk
@ 2009-09-13 16:22 ` Christopher Faylor
  2009-09-13 17:01   ` Philip Semanchuk
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Faylor @ 2009-09-13 16:22 UTC (permalink / raw)
  To: cygwin

On Sun, Sep 13, 2009 at 12:13:42PM -0400, Philip Semanchuk wrote:
>Hi all,
>I'm fooling around with POSIX IPC under Cygwin 1.7 beta and message  
>queues still seem to be broken per the description in this thread:
>http://www.cygwin.com/ml/cygwin/2008-08/msg00539.html
>
>That thread says that a fix is in "-29" [1]. I'm not sure what version  
>I have, but I downloaded my Cygwin 1.7 in August and I see that cygwin- 
>dev is discussing 1.7.0-60, so I assume that my Cygwin is sufficiently  
>up to date.
>
>Should this bug be fixed, or...? Is there anything I can do to help?

You need to read the rest of the thread:
http://www.cygwin.com/ml/cygwin/2008-08/msg00617.html

>[1] - As a Cygwin n00b, I don't know how to get the cygwin release  
>number. I checked the FAQ, but it says, "If you are looking for the  
>version number for the whole Cygwin release, there is none." I'd be  
>happy to report my release number if someone can clue me in.

Being a "n00b" doesn't grant you a "Get Out of Jail Free" card from
paying attention.

Every message to this list ends with this:

>--
>Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>Problem reports:       http://cygwin.com/problems.html
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Documentation:         http://cygwin.com/docs.html
>FAQ:                   http://cygwin.com/faq/

I cut and paste the above from the message that you referenced.  If you
had followed the link for problem reports you would know how to find the
version number.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still  exists
  2009-09-13 16:22 ` Christopher Faylor
@ 2009-09-13 17:01   ` Philip Semanchuk
  2009-09-13 17:15     ` Andy Koppe
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Semanchuk @ 2009-09-13 17:01 UTC (permalink / raw)
  To: cygwin


On Sep 13, 2009, at 12:22 PM, Christopher Faylor wrote:

> On Sun, Sep 13, 2009 at 12:13:42PM -0400, Philip Semanchuk wrote:
>> Hi all,
>> I'm fooling around with POSIX IPC under Cygwin 1.7 beta and message
>> queues still seem to be broken per the description in this thread:
>> http://www.cygwin.com/ml/cygwin/2008-08/msg00539.html
>>
>> That thread says that a fix is in "-29" [1]. I'm not sure what  
>> version
>> I have, but I downloaded my Cygwin 1.7 in August and I see that  
>> cygwin-
>> dev is discussing 1.7.0-60, so I assume that my Cygwin is  
>> sufficiently
>> up to date.
>>
>> Should this bug be fixed, or...? Is there anything I can do to help?
>
> You need to read the rest of the thread:
> http://www.cygwin.com/ml/cygwin/2008-08/msg00617.html

I *did* read the entire thread before I sent my mail. I see one person  
reporting success, but I have twice as many reporting failure. I'm  
wondering if the bug in question didn't get completely fixed.


>> [1] - As a Cygwin n00b, I don't know how to get the cygwin release
>> number. I checked the FAQ, but it says, "If you are looking for the
>> version number for the whole Cygwin release, there is none." I'd be
>> happy to report my release number if someone can clue me in.
>
> Being a "n00b" doesn't grant you a "Get Out of Jail Free" card from
> paying attention. Every message to this list ends with this:
>
>> --
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>> Problem reports:       http://cygwin.com/problems.html
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> Documentation:         http://cygwin.com/docs.html
>> FAQ:                   http://cygwin.com/faq/
>
> I cut and paste the above from the message that you referenced.  If  
> you
> had followed the link for problem reports you would know how to find  
> the
> version number.

Well, the first link on that page is to the Cygwin FAQ which tells me  
that what I'm looking for doesn't exist. Ignoring that and reading  
problems.html I'm still at a loss as to how to get the exact cygwin  
version number.

Before I sent my first mail I tried to parse the output from cygcheck  
but it's pretty overwhelming. I also ran 'uname -srv' didn't contain  
anything that looked like a relevant version number. I also scanned  
Cygwin-dev to see approximately what version number was current. I  
would have been happy to follow a more efficient (and informative) path.

bye
Philip



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still exists
  2009-09-13 17:01   ` Philip Semanchuk
@ 2009-09-13 17:15     ` Andy Koppe
  2009-09-13 17:25       ` Philip Semanchuk
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Koppe @ 2009-09-13 17:15 UTC (permalink / raw)
  To: cygwin

2009/9/13 Philip Semanchuk:
> I also ran 'uname -srv' didn't contain anything
> that looked like a relevant version number.

uname -r normally does the job:

$ uname -r
1.7.0(0.212/5/3)

Unfortunately that doesn't contain the package release number used to
differentiate the beta releases, which is why each beta release
announcement contains this little tidbit:

> FAQ:
> ====
>
> - Q: How do I know that I'm running Cygwin 1.7.0-61?
>
>   A: The `uname -v' command prints "2009-09-11 01:25"

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still exists
  2009-09-13 17:15     ` Andy Koppe
@ 2009-09-13 17:25       ` Philip Semanchuk
  2009-09-13 20:32         ` Christopher Faylor
  0 siblings, 1 reply; 9+ messages in thread
From: Philip Semanchuk @ 2009-09-13 17:25 UTC (permalink / raw)
  To: cygwin


On Sep 13, 2009, at 1:15 PM, Andy Koppe wrote:

> 2009/9/13 Philip Semanchuk:
>> I also ran 'uname -srv' didn't contain anything
>> that looked like a relevant version number.
>
> uname -r normally does the job:
>
> $ uname -r
> 1.7.0(0.212/5/3)
>
> Unfortunately that doesn't contain the package release number used to
> differentiate the beta releases, which is why each beta release
> announcement contains this little tidbit:
>
>> FAQ:
>> ====
>>
>> - Q: How do I know that I'm running Cygwin 1.7.0-61?
>>
>>  A: The `uname -v' command prints "2009-09-11 01:25"

Thanks Andy. Mine is dated 2009-08-20 10:56; I'm sure that's well past  
the 1.7.0-29 release which is the one I'm concerned with.

Cheers
Philip


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still  exists
  2009-09-13 17:25       ` Philip Semanchuk
@ 2009-09-13 20:32         ` Christopher Faylor
  2009-09-21 16:23           ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Faylor @ 2009-09-13 20:32 UTC (permalink / raw)
  To: cygwin

On Sun, Sep 13, 2009 at 01:25:01PM -0400, Philip Semanchuk wrote:
>On Sep 13, 2009, at 1:15 PM, Andy Koppe wrote:
>>> FAQ:
>>> ====
>>>
>>> - Q: How do I know that I'm running Cygwin 1.7.0-61?
>>>
>>>  A: The `uname -v' command prints "2009-09-11 01:25"
>
>Thanks Andy. Mine is dated 2009-08-20 10:56; I'm sure that's well past  
>the 1.7.0-29 release which is the one I'm concerned with.

It is, but there is no reason to be running an earlier version.

I just modified the test case from the original report:

>>>cut here<<<
#include <stdio.h>
#include <mqueue.h>
#include <fcntl.h>
#include <string.h>

main()
{
 int flags = O_RDWR | O_NONBLOCK | O_CREAT | O_EXCL;
 struct mq_attr attr;
 char queue[80];
 char *e;
 mode_t mode = strtoul("644", &e, 8);
 mqd_t mqd;


 memset((void *) &attr, 0, sizeof(struct mq_attr));
 attr.mq_maxmsg = (long) 10;
 attr.mq_msgsize = (long) 24;
 strcpy(queue, "/queue0");
 mq_unlink(queue);
 mqd = mq_open(queue, flags, mode, &attr);
 if (mqd < 0)
   perror("mq_open 1");
 strcpy(queue, "/queue1");
 mq_unlink(queue);
 mqd = mq_open(queue, flags, mode, &attr); // ALWAYS FAIL HERE WITH "Permission denied"
 if (mqd < 0)
   perror("mq_open 2");
}
>>>cut here<<<

It behaves the same on both linux and cygwin.

Make sure that you've read:

http://cygwin.com/faq/faq-nochunks.html#faq.programming.ipc

And have cygserver running properly.

The cygcheck output mentioned on the problems page is not optional.  If
you had provided that in your first message we'd know what version of
cygwin you had installed and if you had cygserver running.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Cygwin 1.7 message queues - permission denied error still  exists
  2009-09-13 20:32         ` Christopher Faylor
@ 2009-09-21 16:23           ` Corinna Vinschen
  2009-09-23 19:46             ` René Liebscher
  0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2009-09-21 16:23 UTC (permalink / raw)
  To: cygwin

On Sep 13 16:32, Christopher Faylor wrote:
> I just modified the test case from the original report:
> 
> >>>cut here<<<
> #include <stdio.h>
> #include <mqueue.h>
> #include <fcntl.h>
> #include <string.h>
> 
> main()
> {
>  int flags = O_RDWR | O_NONBLOCK | O_CREAT | O_EXCL;
>  struct mq_attr attr;
>  char queue[80];
>  char *e;
>  mode_t mode = strtoul("644", &e, 8);
>  mqd_t mqd;
> 
> 
>  memset((void *) &attr, 0, sizeof(struct mq_attr));
>  attr.mq_maxmsg = (long) 10;
>  attr.mq_msgsize = (long) 24;
>  strcpy(queue, "/queue0");
>  mq_unlink(queue);
>  mqd = mq_open(queue, flags, mode, &attr);
>  if (mqd < 0)
>    perror("mq_open 1");
>  strcpy(queue, "/queue1");
>  mq_unlink(queue);
>  mqd = mq_open(queue, flags, mode, &attr); // ALWAYS FAIL HERE WITH "Permission denied"
>  if (mqd < 0)
>    perror("mq_open 2");
> }
> >>>cut here<<<
> 
> It behaves the same on both linux and cygwin.
> 
> Make sure that you've read:
> 
> http://cygwin.com/faq/faq-nochunks.html#faq.programming.ipc
> 
> And have cygserver running properly.

Just FYI, running Cygserver is required only for XSI IPC.  The POSIX
IPC functions are supposed to work without Cygserver.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Re: Cygwin 1.7 message queues - permission denied error still   exists
  2009-09-21 16:23           ` Corinna Vinschen
@ 2009-09-23 19:46             ` René Liebscher
  2009-09-24  9:15               ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: René Liebscher @ 2009-09-23 19:46 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen schrieb:
> On Sep 13 16:32, Christopher Faylor wrote:
>   
>> I just modified the test case from the original report:
>>
>>     
>>>>> cut here<<<
>>>>>           
>> >>> here was the test case which opens 2 queues un same process <<<
>>     
>>>>> cut here<<<
>>>>>           
>> It behaves the same on both linux and cygwin.
>>
>> Make sure that you've read:
>>
>> http://cygwin.com/faq/faq-nochunks.html#faq.programming.ipc
>>
>> And have cygserver running properly.
>>     
>
> Just FYI, running Cygserver is required only for XSI IPC.  The POSIX
> IPC functions are supposed to work without Cygserver.
>
>
> Corinna
>
>   
Hi,

there is another problem with the queues.
The mentioned test case opens two different queues in the same process.

But if you open the same queue in two different processes you get also a
permission denied error.

I add here some test case:
--- file: receiver.c -----------------------
#include <stdio.h>
#include <mqueue.h>
#include <fcntl.h>
#include <stdlib.h>
#include <assert.h>

int
main ()
{
  int i;
  const struct mq_attr attr = {.mq_flags = 0,.mq_maxmsg = 8,.mq_msgsize
= 4,.mq_curmsgs = 0};
  mqd_t mq = mq_open ("/demo", O_RDONLY | O_CREAT, 0644, &attr);
  if (mq == -1) {
    perror ("Receiver: mq_open");
    exit (1);
  }
  for (i = 1; i < 20; i++) {
    int r;
    ssize_t msg_size = mq_receive (mq, (char*)&r, sizeof (r), NULL);
    assert (msg_size == sizeof (int));
    if (msg_size == -1) {
      perror ("Receiver: mq_receive");
      exit (1);
    }
    printf ("%d. received %d\n", i, r);
  }
  mq_close (mq);

  return 0;
}
------------------------------------------
--- file: sender.c ----------------------
#include <stdio.h>
#include <mqueue.h>
#include <fcntl.h>
#include <stdlib.h>

int main (){
  int i;
  const struct mq_attr attr = {.mq_flags = 0,.mq_maxmsg = 8,.mq_msgsize
= 4,.mq_curmsgs = 0};
  mqd_t mq = mq_open ("/demo", O_WRONLY | O_CREAT, 0644, &attr);
  if (mq == -1) {
    perror ("Sender: mq_open");
    exit (1);
  }
  for (i = 1; i < 20; i++) {
    mqd_t mq_result = mq_send (mq, (char *) &i, sizeof (i), 1);
    if (mq_result == -1) {
      perror ("Sender: mq_send");
      exit (1);
    }
    printf ("Sent %d\n", i);
  }
  mq_close (mq);

  return 0;
}
-----------------------------------------
It just sends an integer from sender to receiver.

Compiled on linux with:
gcc -g -o receiver receiver.c -lrt
gcc -g -o sender sender.c -lrt

On Linux you can start them in any order in two terminal windows and get:
---------------------------
# ./sender
Sent 1
Sent 2
...
Sent 18
Sent 19
#
---------------------------
and
---------------------------
# ./receiver
1. received 1
2. received 2
...
18. received 18
19. received 19
#
---------------------------

However on cygwin it doesn't matter which of the processes you start
first, the second one will get a permission denied.
---------------------------
$ ./sender
Sent 1
Sent 2
Sent 3
Sent 4
Sent 5
Sent 6
Sent 7
Sent 8
--- it waits here to get free places in queue (when receiver is running)
---------------------------
But the receiver gets this:
---------------------------
$ ./receiver
Receiver: mq_open: Permission denied
---------------------------

Kind regards

René Liebscher

BTW:
Before someone asks for it:
---------------------------
$ uname -r
1.7.0(0.212/5/3)
$ uname -v
2009-09-11 01:25
---------------------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Re: Cygwin 1.7 message queues - permission denied error still  exists
  2009-09-23 19:46             ` René Liebscher
@ 2009-09-24  9:15               ` Corinna Vinschen
  0 siblings, 0 replies; 9+ messages in thread
From: Corinna Vinschen @ 2009-09-24  9:15 UTC (permalink / raw)
  To: cygwin

On Sep 23 21:46, Ren? Liebscher wrote:
> there is another problem with the queues.
> The mentioned test case opens two different queues in the same process.
> 
> But if you open the same queue in two different processes you get also a
> permission denied error.
> 
> I add here some test case:
> --- file: receiver.c -----------------------
> [...]
> ------------------------------------------
> --- file: sender.c ----------------------
> [...]
> -----------------------------------------
> It just sends an integer from sender to receiver.
> [...]
> However on cygwin it doesn't matter which of the processes you start
> first, the second one will get a permission denied.
> ---------------------------
> $ ./sender
> Sent 1
> Sent 2
> Sent 3
> Sent 4
> Sent 5
> Sent 6
> Sent 7
> Sent 8
> --- it waits here to get free places in queue (when receiver is running)
> ---------------------------
> But the receiver gets this:
> ---------------------------
> $ ./receiver
> Receiver: mq_open: Permission denied
> ---------------------------

Thanks for the testcase!  I could easily reproduce the problem and it
turned out that it was a miserable copy/paste bug.  Due to that the
function opening the mutex object in the second process requests more
access than the process creating the mutex has granted other processes.
Consequentially the second process got a "Permission denied".

I've fixed the bug in CVS.  The next 1.7.0 test release or the next
developer snapshot on http://cygwin.com/snapshots/ (whatever comes
first) will have the patch.


Thanks again for the testcase and the report,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2009-09-24  9:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-13 16:13 Cygwin 1.7 message queues - permission denied error still exists Philip Semanchuk
2009-09-13 16:22 ` Christopher Faylor
2009-09-13 17:01   ` Philip Semanchuk
2009-09-13 17:15     ` Andy Koppe
2009-09-13 17:25       ` Philip Semanchuk
2009-09-13 20:32         ` Christopher Faylor
2009-09-21 16:23           ` Corinna Vinschen
2009-09-23 19:46             ` René Liebscher
2009-09-24  9:15               ` Corinna Vinschen

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).