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 258810 - "Open in Terminal" always opens in /home/myusername
Summary: "Open in Terminal" always opens in /home/myusername
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: ilia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-13 12:43 UTC by terje7601
Modified: 2016-08-11 16:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description terje7601 2016-04-13 12:43:43 UTC
When doing Tools -> Open in Terminal (either by right-clicking the file or through the menu bar), a Terminal opens as expected, but it always opens the default /home/myusername directory, instead of something like /cygdrive/c/folder/containing/the/selected/file. This is with Cygwin64.

Product Version: NetBeans IDE Dev (Build 201604130001)
Java: 1.8.0_77; Java HotSpot(TM) 64-Bit Server VM 25.77-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_77-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 ilia 2016-04-15 08:08:05 UTC
Thanks for reporting an issue!

I've experienced some problems with Cygwin paths.
I'll try to reproduce your configuration early next week.

Do you have non-latin characters, spaces int your path? Or it fails to open for any path?
Comment 2 terje7601 2016-04-15 11:38:49 UTC
It fails to open for any path. For example, I just created a new "Java Application" project, and did "Open in Terminal" on the generated Java class. The expected directory was:
/cygdrive/c/Users/vanelvan/Documents/NetBeansProjects/JavaApplication7/src/javaapplication7
but Cygwin opened in the default directory.

If I do a "cd" to this directory in the terminal, it correctly changes the directory, so I'd say it's not a problem with Cygwin.
Comment 3 ilia 2016-04-17 05:41:17 UTC
Thanks! And after you cd manually, does terminal changes it's title?
Usually it has title like "localhost - <your current cwd>" and updates every time you change directory to another one.
Comment 4 terje7601 2016-04-18 06:37:50 UTC
Yes, the tab changes its title every time.
I don't know if it matters, but my title doesn't have the "localhost - " prefix.

When I do "Open in Terminal", the title is just "~"
When I do cd, the title is "<cwd>", possibly cut off if it's too long: "...end/of/very/long/path"
Comment 5 ilia 2016-04-26 10:30:31 UTC
For some reason Terminal's NativeProcessBuilder on Windows starts in home dir and ignores the "setWorkingDirectory("someDir").

Still investigating.
Comment 6 ilia 2016-08-11 15:59:36 UTC
This issue appears only under Cygwin.

Reason:

When we open run bash under our Terminal we use --login option.
When --login is used bash reads /etc/profile among other init files.

In Cygwin /etc/profile contains lines:

# Make sure we start in home unless invoked by CHERE
if [ ! -z "${CHERE_INVOKING}" ]; then
  unset CHERE_INVOKING
else
  cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!"
fi


which resets our efforts to run bash in a correct directory.
Comment 7 ilia 2016-08-11 16:32:46 UTC
Fixed in:
  https://hg.netbeans.org/cnd-main/rev/ba9f5321ae70