ant uses wrong CWD in screen

Bug #575414 reported by Niels Kasch
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
screen (Ubuntu)
New
Undecided
Unassigned

Bug Description

OS: Ubuntu 9.10
Ant: Apache Ant version 1.7.1 compiled on October 19 2009
Screen: Screen version 4.00.03jw4 (FAU) 2-May-06
Gnome: Gnome 2.28.1 Build Date: 11/03/2009
Bash: GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu)

It appears that screen loses track of the current working directory when a user logs out of Gnome. I have tried to trouble shoot this problem with the assistance of the IRC channel #screen without success (after consulting with #ubuntu-bugs).

The shortest example that I can create to repeatably produce this issue is as follows (the procedure has 14 steps):

1.On Ubuntu 9.10, log into Gnome
2.Open a Bash Terminal
3.Type “mkdir testdir”
4.Type “cd testdir”
5.Create a file called “build.xml” (This is an ant build file) with the following content:
<project basedir="." default="build" name="Test">
    <property environment="env"/>
    <property name="target" value="1.6"/>
    <property name="source" value="1.6"/>
<target name="build"/>
</project>
6.From the terminal start “screen”
7.You should still be in the "testdir" directory. From here, run "ant". Ant's output should be something like:
Buildfile: build.xml

build:

BUILD SUCCESSFUL
Total time: 0 seconds
8.Detach the screen (i.e., Crtl – a d)
9.Type “exit” to close the terminal
10.Log out of Gnome
11.Log back into Gnome
12.Open a Bash Terminal
13.Type “screen -x” to re-attach the screen
14.Run “ant”. This is the point where the error is occurring! The output of ant is as follows:
BUILD FAILED
java.io.FileNotFoundException: /testdir/build.xml (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:190)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
        at org.apache.tools.ant.Main.runBuild(Main.java:743)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds

Notice that ant cannot find the file “/testdir/build.xml”. However, it should look for “/home/user/testdir/build.xml” as the current
working directory (according to pwd) is "/home/user/testdir". It seems that the home directory is being omitted.

The oddity of this problem is that if you continue with the following after step 14, ant will work fine again:
15.cd ..
16.cd testdir
17.ant

As mentioned before, I have tried to troubleshoot this problem with the help of some friendly folks in IRC channel #screen.
We have looked at the following things/possible remedies:

1. My .bashrc file is the default file that comes with Ubuntu 9.10.
2. My .screenrc file is empty.
3. A comparison (diff) of the output of printenv before and after logging out of Gnome, shows no difference.
4. This problem only occurs when actually logging out of Gnome. If screen is detached and re-attached without logging out of Gnome, then this problem does not occur.
5. Changing the line “<project basedir="." default="build" name="Test">
” in build.xml to “<project basedir="/home/user/testdir" default="build" name="Test">
” still causes the same error.
6. Check that nothing “strange” is executed at Gnome logout (i.e., “/etc/gdm/PostSession/Default” only contains “exit 0”)
7. Placing “screen -bash” in .screenrc

Please let me know if I can provide any additional information.
The original problem description can be found at http://pastebin.org/201557

ProblemType: Bug
Architecture: amd64
Date: Tue May 4 16:32:41 2010
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
NonfreeKernelModules: wl nvidia
Package: screen 4.0.3-13ubuntu4
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-21.59-generic
SourcePackage: screen
Uname: Linux 2.6.31-21-generic x86_64
XsessionErrors:
 (gnome-settings-daemon:14034): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (gnome-panel:14126): Gdk-WARNING **: /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window
 (nautilus:14127): Eel-CRITICAL **: eel_preferences_get_boolean: assertion `preferences_is_initialized ()' failed
 (polkit-gnome-authentication-agent-1:14163): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
 (thunderbird-bin:14956): GLib-WARNING **: g_set_prgname() called multiple times

Revision history for this message
Niels Kasch (niels-kasch) wrote :
Revision history for this message
Philip Muškovac (yofel) wrote :

Assigning this to ant for now.

affects: ubuntu → ant (Ubuntu)
Revision history for this message
Emmanuel Bourg (ebourg) wrote :

I fail to see how Ant could be responsible for this issue. Reassigning to screen.

affects: ant (Ubuntu) → screen (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.