Windows WSL2 and humextras

30 views
Skip to first unread message

Joshua Albrecht

unread,
Feb 8, 2024, 12:12:12 PM2/8/24
to Craig Sapp, stars...@googlegroups.com
Hi Craig and group-
I’m teaching a computational musicology course this term, and I have two students who are using Windows 10. Apparently, Windows has built WSL2 now, which makes a Linux sub-installation more natively than Cygwin used to. One student has successfully installed the core Humdrum programs and is using them without problem. The Humdrum data appears to also have downloaded. But we’re running into trouble with the Humextras. When we try 'make update,’ it gets stuck cloning the jrp data. So I have been control-Cing to abort it, and then attempt to enter the hum extras directory and make library. But that never works. Something with counterpoint gets hung up. We end up with a cli directory that seems to have all the programs in cpp, but they don’t show up in the bin, and my impression is that they’re not compiled. Do you have any thoughts for us on how we might get this fixed? The instructions on the Humdrum website still encourage Cygwin, but it feels like WSL2 is a much better environment. But, is that what’s causing the issue?
Thanks much!
-Josh

Craig Sapp

unread,
Feb 8, 2024, 3:02:21 PM2/8/24
to Joshua Albrecht, stars...@googlegroups.com
Hi Josh, 

It might be good for us and a student using WSL2 to meet virtually to see what is going on.  I have tested WSL2 in the past and it seems like a much better solution than cygwin.  WSL1 did not allow access to the Windows file system, but WSL2 does, or at least makes it easier to do so.  (But I haven't tried on WSL2 any time recently, so I will find a Windows computer and test it out -- I have only been using Linux and MacOS).

A first check for access to /tmp directory would be to look at the permissions, which should be writable by anyone.  

ls -ld /tmp

On MacOS there is a complication where /tmp is a pointer to /private/tmp so here is the command I checked:

ls -ld /private/tmp

which returns:

drwxrwxrwt  15 root  wheel  480 Feb  7 22:58 /private/tmp


The characters "drwxrwxrwx" are expected, with "d" meaning a directory, and the first "rxw" mean the owner has read/write/execute permissions, the second "rxw" is for the group's permissions, and the third is for other users (the main one that need w and x permissions. 

Checking the meaning of "t" permissions for executions, it means:

't' stands for the "text" or "sticky bit." For directories, it is commonly referred to as the "restricted deletion flag." When set, only the file owner can delete or modify their own files in the directory.

So there could be a problem if more than one user is using /tmp and the same file name.  If one user create a file in /tmp, then this seems to mean that only they can delete (or overwrite) the same filename.  So that is one possible source of the problem if WSL2 has a similar permission setup for the /tmp directory.

Another possibility is that /tmp is on the Windows file system and Windows is not allowing linux to write to the Windows file system.  I doubt that this is the problem, though.

Another note is that I use Ubuntu in WSL2, and if you are using a different version of linux, you should probably change to Ubuntu which is the most common version of linux to use in WSL2.

On a native installation of Fedora linux, I get the same permissions as in MacOS

drwxrwxrwt. 56 root root 1160 Feb  8 11:52 /tmp


The "." at the end of the permissions seems to be stylistic rather than have any meaning.

In MacOS, permissions are getting strict, and often apps require permission from the user to access various folders/directories.  But I have not seen this for command-line programs, so this is unlikely to be a problem.

-=+Craig


Craig

unread,
Feb 12, 2024, 4:12:23 PM2/12/24
to starstarhug
Hi Josh et al.

Regarding the problem of getting Humdrum Extras running on on WSL2/Ubuntu (plus a few C programs in the awk-based Humdrum Toolkit):  We found the problem, which was: when installing Ubuntu in WSL2, it does not come by default with the C/C++ compiler preinstalled.  You must install the "developer tools" package first:
    sudo apt install build-essential
This may be slightly different on other versions of linux such as:
    sudo dnf install build-essential
on a Fedora version of linux.

On MacOS, there is a similar problem where you need to install the xcode command-line tools, but this is usually not a problem because you should install Homebrew (https://brew.sh) first, and that package management system for MacOS installs the compiling tools as part of its installation process.

After installing the compiling tools from that command, making Humdrum Extras in WSL2/Ubuntu did not have any problems (although there were strange warnings that might be Ubuntu-based that are not important as well as some C++17 warnings in an external library for parsing xml data being used in Humdrum Extras).

The temp directory problem with myank was also solved in our meeting today, but I will send a note about this when it is fixed in the https://github/humdrum-tools/humdrum repository source code for yank.  (It was not a permissions problem for /tmp, but rather the $TMPDIR was empty (as expected, as I will elaborate on later), so the temp files for myank were being written to the root directory (which is not possible unless you have root permissions, and should not be done anyway).

-=+Craig

Joshua Albrecht

unread,
Feb 12, 2024, 4:31:54 PM2/12/24
to stars...@googlegroups.com
Ah, got it. Just to be clear, the problem is with yank and not myank, right? And is this problem just for the WSL2 installation and not Linux or Mac/Unix?

Is your plan to actually change the source code for yank? How often do you update core Humdrum utilities?
Thanks so much for your time and expertise today!
-Josh

--
--
This is a message is from the **HUG newgroup.
To post to this group, send email to stars...@googlegroups.com
To unsubscribe from this group, send email to
starstarhug...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/starstarhug?hl=en
---
You received this message because you are subscribed to the Google Groups "starstarhug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to starstarhug...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/starstarhug/808ffefd-43e9-40ff-bd5b-5d385feead43n%40googlegroups.com.

Joshua Albrecht

unread,
Mar 28, 2024, 12:12:25 PM3/28/24
to starstarhug
Hi all (and Craig)-
Just had the same problem with yank -s on the current installation. My other computer is very old, and I don't even remember how I installed everything (like 2009). But, on my work computer, which has the new humdrum-tools installed on it, yank -s broke. It looks like the problem was in yank5.awk, which had some echo commands in quotes, rather than just the thing to be echoed. Even when I fixed that, I got this error:

echo "$HUMDRUM" | >>>  humdrum_dir <<< 


I'm guessing there's a "getline" command missing before humdrum_dir, but I don't know enough about it to feel confident in changing that line in the .awk file.

Thanks!
-Josh

Craig Sapp

unread,
Mar 28, 2024, 12:23:39 PM3/28/24
to stars...@googlegroups.com
Hi Josh,

Can you send me your old yank5.awk file?  And some sample data to test on with expected output.

But I think you are right: adding "getline" in the following code should fix the problem (line 95):

91         # system("$AWK_VER -f ${HUMDRUM}/bin/number.awk '" LABEL "' " FILENAME " > $TMPDIR/yank5$")

 92         # "cat $TMPDIR/yank5$" | getline max_occurrences

 93         # close("cat $TMPDIR/yank5$")

 94         #max_occurrences = max_occurrences + 0

 95         "echo $HUMDRUM" | humdrum_dir

 96         if (humdrum_dir == "") {

 97                 "echo $PATH | tr : '\n' | grep 'humdrum/bin$' | head -n 1" | getline humdrum_dir

 98                 sub(/\/bin$/, "", humdrum_dir)

 99         }

100         "echo $AWK_VER" | getline awkver

101         if (awkver == "") {

102                 "which awk" | getline awkver

103         }

104         if (awkver == "") {

105                 "which gawk" | getline awkver

106         }


-=+Craig



Joshua Albrecht

unread,
Mar 28, 2024, 12:28:42 PM3/28/24
to stars...@googlegroups.com
Sure thing! 
Here's the command:

yank -s 'A' -r 1 inven06.krn


on the Bach invention.

I added getline (and changed the quote so it wasn't around the echo, too. I see now that I should've left the quote where it was. I put it back, and just added getline. It now seems to be working. Thanks!
-Josh

Craig Sapp

unread,
Mar 28, 2024, 12:49:40 PM3/28/24
to stars...@googlegroups.com
Hi Josh,

What do you get as output for the command

yank -s 'A' -r 1 inven06.krn

I am getting this output after adding getline:

*- *-


which does not very interesting.

-=+Craig


Joshua Albrecht

unread,
Mar 28, 2024, 2:37:41 PM3/28/24
to stars...@googlegroups.com
Not very interesting, indeed. Perhaps you're using a different version. In mine, David has encoded section labels, and even specific performance information (e.g. *MM56.4), about the Andras Schiff performance from Decca 411 974-2). Here's my output.
Thanks again!
-Josh

--
--
This is a message is from the **HUG newgroup.
To post to this group, send email to stars...@googlegroups.com
To unsubscribe from this group, send email to
starstarhug...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/starstarhug?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "starstarhug" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/starstarhug/l4kHTrV5FLQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to starstarhug...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/starstarhug/CAPcjuFcQYOd_RHx-hQ_FW3hbsJpUJC8qGuahqcWy1FEwVek8aw%40mail.gmail.com.

Joshua Albrecht

unread,
Mar 28, 2024, 2:39:18 PM3/28/24
to stars...@googlegroups.com
I suppose I could give you my file, at any rate. Attached.
-Josh
inven06.krn

Claire Arthur

unread,
Aug 20, 2024, 11:47:31 AM8/20/24
to starstarhug
Hi Josh and Craig, 

Just piggybacking on this thread. I'm about to teach my course as well and wondering about the WSL2 versus Cygwin (it seems crazy that they'd need cygwin in 2024?!) I had made install instructions two years ago and I'm hoping they still work (I cannot, however, recall whether these apt-get commands would even work in a windows command shell? Presumably not? Do my install instructions assume they have cygwin or linux already?) It's been 6 months and I do see that the humdrum install instructions still suggest one needs cygwin...

Claire

Reply all
Reply to author
Forward
0 new messages