Categories
Computers

GitHub (née Microsoft) buys NPM

Weird timeline we’re in, eh? While we all sit and hope for the best with COVID-19 taking an unprepared humanity to task, Microsoft (through GitHub) is making an interesting move.

I have to say, it’s an interesting proposition. Microsoft wants to improve and control the popular NPM (Node Package Manager) repository. This is where JavaScript developers go to download modules for Node.js so that they can build their applications. Microsoft will now own this repository.

Honestly, I’m a little torn. On one hand, I dislike the increasing creep of JavaScript “applications” that are run on Node/Electron because they’re not usually well optimized and eat resources like crazy. On the other hand, Node’s repository has been notorious for squatters, malicious files being uploaded into popular modules and even the transfer or takeover of popular modules by hostile entities without any notification. Some sort of corporate curation and regulation (not to mention proper infrastructure and funding) will help.

Ultimately it seems like just another piece of the Open Source pie being consumed by corporations. While NPM is a handy tool for development in Node, I’m sure this change of ownership will prompt an exodus, as the GitHub acquisition did before it.

When it does, we’ll all be the better for it. More diverse sources allow for less single points of failure or control. I wouldn’t be surprised if the popular distributed git-forge idea spawns into a distributed NPM-analog.

Update: It was pointed out to me that there is, in fact, an alternate package repo tool/project tool: Yarn. I’m not a Node developer, but I am extremely happy that it exists and can be a stand-in for NPM.

Categories
Computers Rants

Historical Function

Today, I delved into a tiny bit of X11/xorg plumbing to see if I could move this damnable .xsession-errors file to someplace more out of the way. For those of you not in the know about Linux or X11, it’s basically a holding tank of any GUI application errors that aren’t normally logged. To me, it seems vestigial of a time before centralized system logging via systemd, but who am I to question our forefathers?

Well, damn it, it’s open source! Lets see if I can fuck with it and make it do what I want it to do!

Turns out no. At least not easily.

Inside /etc/X11/Xsession (on Debian, anyway), exists the following bit of code to create or temporarily create an error log file:

ERRFILE=$HOME/.xsession-errors

# attempt to create an error file; abort if we cannot
if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
  [ ! -L "$ERRFILE" ]; then
  chmod 600 "$ERRFILE"
elif ERRFILE=$(tempfile 2> /dev/null); then
  if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
    message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
             "\"$ERRFILE\"; look for session log/errors in" \
             "\"$TMPDIR/xsession-$USER\"."
  fi
else
  errormsg "unable to create X session log/error file; aborting."
fi

exec >>"$ERRFILE" 2>&1

The gist (haha) here is that if you don’t have one, make it, if you can’t make it, create a dummy one in the system temp folder and if that fails, just give up. All well and good, right? Right.

So, what happens if we, say, modify the ERRFILE path to something else? Well, I tried that and I got an unexpected result: The file being created correctly in the right location (yay) and an empty file created in the original location (boo).

Excuse me, what the actual fuck?

Right now, I’m kind of at an impasse here. It seems like changing the code above to do what I want it to do works but there is something probably hard-coded elsewhere that just goes “DUMP IT IN $HOME/.xsession-errors“, which is frustrating. I don’t know where else to look. If anyone has any ideas, let me know, I’d be glad to credit you.

Update

I thought I had a smoking gun. I redirected everything in my .xprofile to two different logs, manually. This logged correctly, but I still got a leftover file, let’s see who has it open:

Oh, hello i3bar….

So, I go and re-introduce my changes to Xsession, like so:

# Original
# ERRFILE=$HOME/.xsession-errors
ERRFILE=$HOME/.cache/xorg/errors

# attempt to create an error file; abort if we cannot
# if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
#   [ ! -L "$ERRFILE" ]; then
#   chmod 600 "$ERRFILE"
# elif ERRFILE=$(tempfile 2> /dev/null); then
#   if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
#     message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
#              "\"$ERRFILE\"; look for session log/errors in" \
#              "\"$TMPDIR/xsession-$USER\"."
#   fi
# else
#   errormsg "unable to create X session log/error file; aborting."
# fi

exec >>"$ERRFILE" 2>&1

I checked and it dumps the standard rigamarole from X starting up. That’s good(tm). Problem is, I still get an (empty) .xsession-errors file.

Time to investigate sway/wayland.

Categories
Computers Media

Python is Fun

Python is fun.

No, really, it’s fun. There are a bunch of modules that make it easy to implement ideas that may feel complex in other languages (I’m looking at you Perl.).

😀

Not to mention, the most excellent program (for mac) TextMate makes it all the more fun It does auto- complete and you can run your script inside TextMate with a single command (or externally with a different, single, command).

Categories
Computers Misc

WordPress is Hell

I’m currently in wordpress function hell.

Please stand-by.

Okay. So.

I’ve been mucking about in the lewd underthings of WordPress today, and I’ve come across some interesting and disappointing things. First off is that despite what is shown in the codex, there are a lot of functions buried inside of WordPress. A great deal of them are hideous, many more are pointless. (I’m looking at you _())