This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225920 - C makefile build fails with "Permission denied"
Summary: C makefile build fails with "Permission denied"
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Andrew Krasny
URL:
Keywords: REGRESSION, RELNOTE
Depends on:
Blocks:
 
Reported: 2013-02-08 22:24 UTC by sindisil
Modified: 2014-01-22 11:46 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (47.89 KB, text/plain)
2013-02-08 22:24 UTC, sindisil
Details
screen cap of 7.3B2 clean & build with -noexec /tmp (61.21 KB, image/png)
2013-02-11 15:36 UTC, sindisil
Details
screen cap of 7.3RC2 clean & build with -noexec /tmp (75.72 KB, image/png)
2013-02-11 15:37 UTC, sindisil
Details
screen cap of 7.3B2 clean & build with /tmp allowing exec (59.73 KB, image/png)
2013-02-11 15:37 UTC, sindisil
Details
screen cap of 7.3RC2 clean & build with /tmp allowing exec (61.35 KB, image/png)
2013-02-11 15:38 UTC, sindisil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sindisil 2013-02-08 22:24:38 UTC
Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851)
Operating System = Linux version 2.6.32-279.el6.x86_64 running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01


Project builds fine with 7.3b2, but using 7.3RC2 I get:

------------
Cannot run program "/tmp/dlight_gregj/33e48052/01004131055/pty": error=13, Permission denied


BUILD FAILED (exit value -2, total time: 54ms)
-------------


Both versions of Netbeans installed to /opt/netbeans, which is chowned to my user.



/tmp is mounted rw,noexec,nosuid,noatime and is tmpfs
Comment 1 sindisil 2013-02-08 22:24:40 UTC
Created attachment 131180 [details]
IDE log
Comment 2 sindisil 2013-02-09 00:29:39 UTC
Debug also fails with similar symptoms.

Since the errors seem to indicate inability to execute something from /tmp, I tried remounting /tmp without -noexec, and can verify that build and debug then work.

Again, 7.3 Beta 2 did not have this issue.

Since it's typical to mount /tmp -noexec for security reasons, I don't think the current RC2 behavior is appropriate.
Comment 3 Andrew Krasny 2013-02-11 10:56:43 UTC
It it unlikely that this worked in Beta 2. 

When this (noexec) issue was reported for the first time, a special flag "cnd.tmpbase" was introduced to make it possible to re-define a base of temp files. So one can start nb with -J-Dcnd.tmpbase=/var/tmp/nbtmp to change the default location.

This situation should be handled in a better way, for sure... 
But this is not a showstopper as well as not a P2 issue.
Comment 4 sindisil 2013-02-11 15:36:45 UTC
Created attachment 131243 [details]
screen cap of 7.3B2 clean & build with -noexec /tmp
Comment 5 sindisil 2013-02-11 15:37:16 UTC
Created attachment 131244 [details]
screen cap of 7.3RC2 clean & build with -noexec /tmp
Comment 6 sindisil 2013-02-11 15:37:53 UTC
Created attachment 131245 [details]
screen cap of 7.3B2 clean & build with /tmp allowing exec
Comment 7 sindisil 2013-02-11 15:38:17 UTC
Created attachment 131246 [details]
screen cap of 7.3RC2 clean & build with /tmp allowing exec
Comment 8 sindisil 2013-02-11 16:01:09 UTC
(In reply to comment #3)
> It it unlikely that this worked in Beta 2.

Really?

If you're going to call me a liar, at least have the courtesy to have checked it out yourself first.

I've attached screen caps showing the behavior in NetBeans, along with verification of my mount options on /tmp for each run.

It worked on Beta 2

It did not with RC2.

> When this (noexec) issue was reported for the first time, a special flag
> "cnd.tmpbase" was introduced to make it possible to re-define a base of temp
> files. So one can start nb with -J-Dcnd.tmpbase=/var/tmp/nbtmp to change the
> default location.

I searched before opening this bug, and found zero hits on "noexec". Searching just now, I find only this bug.

I assume the issue you're referring to is Bug 216366. I was able to find it now, but only because I added "cnd.tmpbase" to the search string.

No where in the release notes do I see reference to this issue, so while I thank you for the information on the workaround, I think perhaps adding it to release notes would be appropriate if will not be fixed in a cleaner way for 7.3 release.

> This situation should be handled in a better way, for sure... 

That is indeed "for sure".

> But this is not a showstopper as well as not a P2 issue.

Given that there's a workaround (mount /tmp w/o -noexec, if that's an option, else set cnd.tmpbase), I would agree, though for it to be P3 your wiki states that there must be a "viable workaround". I'd say the workaround is only really "viable" if it's documented, no?
Comment 9 Andrew Krasny 2013-02-11 17:34:18 UTC
(In reply to comment #8)
> (In reply to comment #3)
> > It it unlikely that this worked in Beta 2.
> 
> Really?
> 
> If you're going to call me a liar, at least have the courtesy to have checked
> it out yourself first.
> 

;) Wow, wow.. Not so aggressive, please.. 
Nobody wanted to call you a liar - it was just an assumption (unlikely != it was not).

> I've attached screen caps showing the behavior in NetBeans, along with
> verification of my mount options on /tmp for each run.
> 
> It worked on Beta 2
> 
> It did not with RC2.

OK, thanks for the screenshots - I'll take a closer look on the issue, but the first thing I did is I tried to provide an information about possible available workaround.

> 
> > When this (noexec) issue was reported for the first time, a special flag
> > "cnd.tmpbase" was introduced to make it possible to re-define a base of temp
> > files. So one can start nb with -J-Dcnd.tmpbase=/var/tmp/nbtmp to change the
> > default location.
> 
> I searched before opening this bug, and found zero hits on "noexec". Searching
> just now, I find only this bug.
> 
> I assume the issue you're referring to is Bug 216366. I was able to find it
> now, but only because I added "cnd.tmpbase" to the search string.
> 
> No where in the release notes do I see reference to this issue, so while I
> thank you for the information on the workaround, I think perhaps adding it to
> release notes would be appropriate if will not be fixed in a cleaner way for
> 7.3 release.
> 
> > This situation should be handled in a better way, for sure... 
> 
> That is indeed "for sure".
> 
> > But this is not a showstopper as well as not a P2 issue.
> 
> Given that there's a workaround (mount /tmp w/o -noexec, if that's an option,
> else set cnd.tmpbase), I would agree, though for it to be P3 your wiki states
> that there must be a "viable workaround". I'd say the workaround is only really
> "viable" if it's documented, no?

Yep. I agree that this information should go to the release notes.
Comment 10 sindisil 2013-02-11 18:24:04 UTC
(In reply to comment #9)
Sorry - your answer seemed to be a pretty direct dismissal of my assertion.

Regardless, I suppose I could have been more clear that I had verified behavior; perhaps including screen caps up front.
Comment 11 sindisil 2013-02-11 18:28:57 UTC
Hrm - I'm trying your workaround, but with no success.

I edited /opt/netbeans/netbeans-7.3rc2/etc/netbeans.conf to add either "-J-Dcnd.tmpbase=/var/tmp" or "-J-Dcnd.tmpbase=/var/tmp/nbtmp" to netbeans_default_options, and it seems to have no effect.

The error in output is still:

------
Cannot run program "/tmp/dlight_gregj/33e48052/01004131055/pty": error=13, Permission denied


CLEAN FAILED (exit value -2, total time: 60ms)

------
Comment 12 soldatov 2013-02-11 19:45:43 UTC
(In reply to comment #11)
> Hrm - I'm trying your workaround, but with no success.
Agree
Comment 13 Andrew Krasny 2013-02-12 06:09:54 UTC
sindisil, Valera, 

I see what's going on... It's a typo in the http://hg.netbeans.org/cnd-main/rev/0a835f7d4d7d (that is why passing cnd.tmpbase has no effect).

I guess there is something like "Ignoring cnd.tmpbase property..." in your messages.log... 

It could be easily fixed. I will fix it today.
 
Valera, is it a showstopper? 
sindisil, thanks for finding the issue!

=Andrew
Comment 14 soldatov 2013-02-12 07:36:57 UTC
(In reply to comment #13)
> Valera, is it a showstopper? 
No I think. But issue can be fixed in patch1.
Comment 15 sindisil 2013-02-12 14:50:20 UTC
(In reply to comment #13)
Sweet.

Thanks for digging in and finding root cause, Andrew! Glad it's an easy fix.
Comment 16 sindisil 2013-02-12 14:52:03 UTC
(In reply to comment #14)
I understand you have a release to ship, but think it's unfortunate that folks will need to choose between a useful security configuration and all the goodness that's coming in 7.3.
Comment 17 Andrew Krasny 2013-02-12 16:28:58 UTC
Well, I have fixed a typo and now at least cnd.tmpbase should have effect.

[http://hg.netbeans.org/cnd-main/rev/3772eaebd91f]

Another workaround that could be used (even on the current code) is that one can give -J-Djava.io.tmpdir=</var/tmp/nbtmp> to redefine the directory to use.  But this option has more global effect, so this directory will be used not for our dlight_* stuff only...
Comment 18 Quality Engineering 2013-02-13 01:53:30 UTC
Integrated into 'main-golden', will be available in build *201302122300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3772eaebd91f
User: Andrew Krasny <akrasny@netbeans.org>
Log: Bug #225920 - C makefile build fails with "Permission denied"
Comment 19 Andrew Krasny 2013-02-14 14:06:25 UTC
I'll close this issue with the current fix (use of cnd.tmpbase property) to make it a candidate for 73 patch.
I'll open another IZ for enhancing usability improvements for this situation.
Comment 20 soldatov 2013-03-12 13:22:09 UTC
Verified in trunk 201303112300

I can launch sample via -J-Dcnd.tmpbase=/var/tmp/nbtmp flag
Comment 21 Quality Engineering 2013-03-14 21:15:03 UTC
Integrated into 'releases', will be available in build *201303141828* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/1adce2768213
User: Andrew Krasny <akrasny@netbeans.org>
Log: Bug #225920 - C makefile build fails with "Permission denied"
(transplanted from 3772eaebd91ff483d3b078e7f6463589aba2570d)
(transplanted from d12dda9844e733c7545cd113ecda54077518bba4)
Comment 22 soldatov 2013-03-19 06:52:11 UTC
Verified in build 201303172200
Comment 23 sicherer 2014-01-21 19:49:30 UTC
I was glad to see it is fixed, because I have this very annoying bug in 7.3 too, but just now I installed 7.4 and it still gives me this bug?!?

I have Ubuntu 12.10 with gcc Ubuntu/Linaro 4.6.3-10ubuntu1

I created a new project from existing code with the following Makefile:
---
# makefile for NetBeans 7.4 test
CPP     = g++
CFLAGS  = -I /usr/local/include -Wall
LFLAGS  = -L /usr/local/lib64 -L /usr/local/lib -lm

all     = testprog

OBJS    = testprog.o

testprog: ${OBJS} 
	${CPP} -o $@ ${OBJS} ${LFLAGS} 
	
%.o : %.cpp
	${CPP} ${CFLAGS} -o $@ -c $<

clean:
	rm -f testprog *.o core *~ *.bak
---
testprog.cpp:
---
#include <iostream>
int main(int argc, char* argv[])
{
    std::cout << "Hello, world!" << std::endl;
}
---
This builds fine from the command line. However, in NetBeans, upon building the code with F11 I got the same as before:
---
Cannot run program "/tmp/dlight_anneke/751a23a2/1763953319/pty": error=13, Permission denied
MAKE FAILED (exit value -2, total time: 52ms)
---
The about box says this among other things:
---
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
---
Is the bug back??? Please help!!
Comment 24 soldatov 2014-01-22 07:13:02 UTC
(In reply to sicherer from comment #23)
> Is the bug back??? Please help!!
Do you speak "I use -J-Dcnd.tmpbase=/var/tmp/nbtmp flag, but run and build fails"?