View Issue Details

IDProjectCategoryView StatusLast Update
0002309OpenFOAMBugpublic2016-11-05 15:29
Reporterwyldckat Assigned Tohenry  
PrioritylowSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version16.04
Summary0002309: Some csh versions/forks seem to have problems with line breaks inside inline subshells
DescriptionThe issue I've stumbled upon with the "csh" package "20110502-2.1ubuntu1" in Ubuntu 16.04 (dpkg -l csh) is that a single backslash within the sub-shells using `` require double backslash and not a single backslash.

The problem is that I have not seen any similar report by anyone else, including on the OpenFOAM-plus issue tracker, and since Henry must have tested the script with success with a particular version or two, I'm really intrigued as to which csh versions/forks the current implementation in OpenFOAM 4.0 and newer works on.

Anyway, attached are two possible patches for extending compatibility, for easier inspection, on possible solutions:

  - patch.v1 - uses double backslash inside `` sub-shells
  - patch.v2 - uses removes backslash from inside `` sub-shells and makes the command a single line

The affected files are only these two:

  - etc/config.csh/paraview
  - etc/cshrc
Steps To Reproduce# While on bash:
$ cd ~/OpenFOAM/OpenFOAM-dev
$ csh
% source etc/cshrc
Invalid null command.
/OpenFOAM-dev/bin/foamEtcFile: Command not found.
/OpenFOAM-dev/bin/foamCleanPath: Command not found.
/OpenFOAM-dev/bin/foamCleanPath: Command not found.
/OpenFOAM-dev/bin/foamCleanPath: Command not found.
/OpenFOAM-dev/etc/config.csh/settings: No such file or directory.
Additional InformationFound while investigating issues with sourcing "etc/bashrc" (reporting on it soon), I ended up doing some tests with csh as well.
TagsNo tags attached.

Activities

wyldckat

2016-10-29 20:55

updater  

patch.v1 (943 bytes)

wyldckat

2016-10-29 20:55

updater  

patch.v2 (1,067 bytes)

wyldckat

2016-10-29 20:58

updater   ~0007070

Any chance we can get feedback from other csh users on this as well?
I'm thinking of @MattijsJ, but I don't know/remember who else uses csh.

henry

2016-10-29 22:20

manager   ~0007071

I test OpenFOAM with csh on OpenSuSE Tumbleweed and it seems fine. If there are serious problems with maintaining support for csh I think it is time to drop it.

henry

2016-10-29 22:23

manager   ~0007072

Note that on OpenSuSE csh is actually tcsh, with dpkg -l csh do you actually get an old csh or tcsh?

wyldckat

2016-10-29 22:40

updater   ~0007074

I had installed the "csh" package... uh, wait, actually, the "openfoam4" package installed it for me!?
Anyway, "csh" is apparently an old version, which in the associated Deb description says "This package is based on current OpenBSD sources."

"tcsh" is not in my Ubuntu 16.04 installation. It's part of the "universe" repository, so that might be why the "openfoam4" package didn't use it?

henry

2016-10-29 23:59

manager   ~0007076

You will need to install tcsh rather than csh.

wyldckat

2016-10-30 00:51

updater   ~0007078

I've installed tcsh in my Ubuntu 16.04 installation ("dpkg -l tcsh" states it's version 6.18.01-5) and it does seem to work as intended without any of the proposed changes.

There were a couple of lines that showed up which seemed a bit odd:

  /home/ofuser/OpenFOAM
  ParaView_DIR: Undefined variable.

The first one was because of the debugging command line in "etc/cshrc" right after getting the path. The second one was because of the first cleaning line in "etc/config.csh/paraview", which seems to be only a warning.


Then I guess the only real issue was that "csh" was part of the dependencies on the "openfoam4" Deb package... which should be changed to "tcsh"?

henry

2016-10-30 09:43

manager   ~0007079

I have removed the spurious 'echo' but cannot reproduce the

ParaView_DIR: Undefined variable.

and not sure what if anything to do about it.

It should be possible to remove the dependency on "csh" altogether now that all of the "csh" scripts have been rewritten is "sh", we will check.

wyldckat

2016-10-30 10:08

updater   ~0007080

> cannot reproduce the

That is either due to something a little different between tcsh versions or because you went into tcsh with a pre-loaded Bash environment. Please try (starting from the Bash environment):

  foam
  wmUnset
  tcsh
  source etc/cshrc


As for undefined variable, adding the following line before the first script code does the trick:

  if ( ! $?ParaView_DIR ) setenv ParaView_DIR


The following attached patch file "etc_config_csh_paraview.patch" gives the full location of this fix.
etc_config_csh_paraview.patch (556 bytes)   
diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview
index 16fa58d..e2d0205 100644
--- a/etc/config.csh/paraview
+++ b/etc/config.csh/paraview
@@ -34,6 +34,8 @@
 #
 #------------------------------------------------------------------------------
 
+if ( ! $?ParaView_DIR ) setenv ParaView_DIR
+
 # Clean the PATH
 set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
 if ( $status == 0 ) setenv PATH $cleaned

chris

2016-11-03 09:38

manager   ~0007088

If the double backslash works for a line continuation on all csh environments, then I suggest we go with that.

csh is no longer mentioned in the Ubuntu pack installation instructions, so I will remove csh from the dependencies for those packs, starting with the next openfoam-dev pack.

Also will remove reference to csh in latest (and future) source installation instructions, e.g. http://openfoam.org/download/4-1-source/, leaving just tcsh.

henry

2016-11-04 13:35

manager   ~0007090

Resolved in OpenFOAM-4.x by commit c590630ab07e4981c7cd9d15e2a75cfc5efcf364

Resolved in OpenFOAM-dev by commit commit fcdfddf5a72b6041d6f9a90d9072ac81a99556b2

Dependency on "csh" to be removed from future .deb packs.

wyldckat

2016-11-05 15:02

updater   ~0007093

Sorry for the delay, but just to wrap up the remaining detail, @Chris commented:

> If the double backslash works for a line continuation on all csh environments, then I suggest we go with that.

I've tested just now and no, it doesn't work with tcsh. Ironically, using the double backslash will result in the same error messages that occur when a single backslash is used in csh.

chris

2016-11-05 15:13

manager   ~0007095

OK, so reluctantly it looks like we need to revert to the option where the commands are on a single line.

chris

2016-11-05 15:29

manager   ~0007096

Correction: it has been left with a single \ and we do not support csh, at least not the BSD version.

Issue History

Date Modified Username Field Change
2016-10-29 20:55 wyldckat New Issue
2016-10-29 20:55 wyldckat File Added: patch.v1
2016-10-29 20:55 wyldckat File Added: patch.v2
2016-10-29 20:58 wyldckat Note Added: 0007070
2016-10-29 22:20 henry Note Added: 0007071
2016-10-29 22:23 henry Note Added: 0007072
2016-10-29 22:40 wyldckat Note Added: 0007074
2016-10-29 23:59 henry Note Added: 0007076
2016-10-30 00:51 wyldckat Note Added: 0007078
2016-10-30 09:43 henry Note Added: 0007079
2016-10-30 10:08 wyldckat File Added: etc_config_csh_paraview.patch
2016-10-30 10:08 wyldckat Note Added: 0007080
2016-11-03 09:38 chris Note Added: 0007088
2016-11-04 13:35 henry Assigned To => henry
2016-11-04 13:35 henry Status new => resolved
2016-11-04 13:35 henry Resolution open => fixed
2016-11-04 13:35 henry Fixed in Version => 4.x
2016-11-04 13:35 henry Note Added: 0007090
2016-11-05 15:02 wyldckat Status resolved => feedback
2016-11-05 15:02 wyldckat Resolution fixed => reopened
2016-11-05 15:02 wyldckat Note Added: 0007093
2016-11-05 15:03 wyldckat Status feedback => resolved
2016-11-05 15:03 wyldckat Resolution reopened => fixed
2016-11-05 15:13 chris Note Added: 0007095
2016-11-05 15:29 chris Note Added: 0007096