Is vi command-line editing broken in sbt? - sbt

My .inputrc file configures editing-mode as 'vi'. In recent sbt versions (since 13.10), my interactive command line defaults to vi's command-mode instead of insert-mode, so each time I hit return I have to enter 'i' or 'a' before I can type a command. Versions prior to 13.10 do the more typical thing of defaulting to insert-mode, like bash does.
Is this a bug? Is there a workaround?

FIXED -- I had another line 'set keymap vi' in my .inputrc that was causing the problem. I'm not sure why or when I put that in there, but I removed it and things are back to normal.

sbt uses jline under the hood and is thus affected by your ~/.inputrc configuration. jline is modeled on GNU read line and, as such, having set keymap vi should instruct jline to begin in command mode. (That it didn't is a bug, more on that soon.) If you want to keep the keymap declaration, and you want the insert behavior, use set keymap vi-insert.
As to the bugginess, sbt 0.13.9 uses jline 2.11 while sbt 0.13.10 uses jline 2.13. There were 136 commits in that range, in which we find this change:
Bingo. vi keymap changed to the movement mode from the insert mode.

Related

GNAT Recompiling Libray files / how to force recompile all

I have an error where I get that file X (in the standard library) needs recompiling as another file has changed. It had changed, as I accidentally changed it but corrected the change (confirmed with md5sum check). However the timestamp has changed, so now other items won't compile due to this. Short of reinstalling (which surely isn't necessary, but is possible) what's the solution to this?
I've tried adding the -f option to gprbuild when building to force recompiling and I get the same result.
Exact error:
error: "a-direct.adb" must be recompiled ("a-calfor.ads" has been modified)
error: "a-calfor.adb" must be recompiled ("a-calfor.ads" has been modified)
error: "g-calend.adb" must be recompiled ("a-calfor.ads" has been modified)
...
When invoked on a user project, gprbuild knows about compiling that project (and its dependencies), not the runtime.
AdaCore’s customers are provided, I think, with support to recompile the runtime, and there are GPRs and a daunting Makefile in the GCC sources.
gnatmake has a switch -a which forces any necessary recompilation of runtime sources into your object directory. I don’t think gprbuild supports it, and in any case you’d need to invoke it for all your projects.
If I were you I would just go ahead and reinstall.
Ok, this is probably not the intention of the warnings, but I just needed to get going. So I added (as per the help for gnatbind) -- adding the -t option for the binder with the following in gprbuild.
gprbuild -<options> -P <project_file>.gpr -bargs -t
which changed the error into a warning and produced my executable.
Obviously not the "right" way to solve the error, but that part wasn't critical, and I needed to get on.

What does the GNU makefile flag "-m" mean, and how does it operate in the line "Obj -m += simple.o"?

I'm am taking a course in operating systems, and we were asked to explain the syntax of a given makefile. However, I'm having trouble understanding the contents:
Obj -m += simple.o
all:
make -C/lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C/lib/modules/$(shell uname -r)/build M=$(PWD) clean
The main part I don't understand is the first line. From what I know "Obj" is a variable name "-m" is a flag "+=" is the concatenate operator "simple.o" is the object file. Even though I know the parts I don't know what this line does. I have searched extensively, but I can't find any explanation of "-m" flag. It showed up in only one list explaining that the compiler knows to ignore it, see here https://www.gnu.org/software/make/manual/html_node/Options-Summary.html. Can someone explain what this line means and does?
That is a Linux kbuild makefile for an out-of-kernel-tree module. As #MadScientist has pointed out your first line should read
obj-m += simple.o
In Linux kbuild context this means "compile and link simple.c to the module". The goal all (default goal) will build the module against the kernel version you are currently running on.
NOTE: you'll need to install the kernel development headers in order for the module build to succeed.
EDIT: inside the Linux kernel tree you'll also find the notation obj-y += X which means "compile and link X into the kernel when this kernel config has been enabled".

how to remove the Patch from console

I am applying Patch to my programm with command line:
msiexec /p Patch.msp -l*v log.txt
But how to remove the Patch from console? Not to remove the product at all.Only Patch.
Now I am using ARP Panel for this cause. But i can't get logs.
Starting with Windows Installer 3.0, you can uninstall patches. There are two methods you can use on the command line:
Using MSIPATCHREMOVE on a command line
msiexec /i {GUID-OF-PRODUCT} MSIPATCHREMOVE={GUID_OF_PATCH} /qb
Using the standard command line options
Msiexec /package {GUID-OF-PRODUCT} /uninstall {GUID_OF_PATCH} /passive
For more information, read Uninstalling Patches article on MSDN.
No all patches can be removed individually. You must author a special kind of patch called "Uninstallable Patch" in order to remove it.
You can read more here on how to remove patches:
http://msdn.microsoft.com/en-us/library/aa371212(VS.85).aspx
The other answers need product's GUID, it's not easy to get it.
Here's another way:
Msiexec /i {installpath_of_product} MSIPATCHREMOVE={installpath_of_patch} /qb

Zsh wants to autocorrect a command, with an _ before it

I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc.
When I type in:
ruby -v
to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at the prompt after confirming my command is correct.
I'm assuming there is a completion file or something of the sort.
Thanks
Update:
The shell is no longer trying to complete _ruby, it stopped responding after closing the shell a few times some how.
I tried to clean the file up several times but there is a "opts" variable that is 50 or more lines long and the lines are all ran together, some lines more than 150 characters. Maybe I could email an attachment to you if you still want to see it.
I sincerely apologize for the messy post.
This is command autocorrection, activated by the correct option. It has nothing to do with completion. You're seeing _ruby because zsh thinks there is no ruby command and it offers _ruby as the nearest existing match.
If you've just installed ruby, it's possible that zsh has memorized the list of available command earlier, and it won't always try to see if the command has appeared in between. In that case, run hash -rf. Future zsh sessions won't have this problem since the ruby command already existed when they started.
Sometimes, when you change your PATH, zsh forgets some hashed commands. The option hash_listall helps against this. As above, if you can force zsh to refresh its command cache with hash -rf.
You could make an alias:
alias ruby='nocorrect ruby'
It's what I did when zsh kept asking me if I meant .meteor when I typed meteor because auto-correct is still useful from time to time.
I find the autocorrect feature can get annoying at times. So I do in my ~/.zshrc,
DISABLE_CORRECTION="true"
I had the same problem even when the command is not installed.
I can solve it using the CORRECT_IGNORE variable in my .zshrc
# OPTs to enable
setopt HASH_LIST_ALL
setopt CORRECT
# Zsh variable to determine what to ignore,
# in this case everything starting with _ or .
CORRECT_IGNORE="[_|.]*"
I hope it helps to you or anyone with this issue
Sometime ago after an update, I got command auto-correction enabled which I don't want. If the same happened to you and you want to revert it, in the ~/.zshrc file you'll have make it:
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="false"
or comment it as per bellow:
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
Just a note, on my zsh (version 5.7.1 on macOS), the DISABLE_CORRECTION didn't work.
I saw in my .zshrc file the following two lines, which I then commented out
setopt CORRECT
setopt CORRECT_ALL
That did it for me.

GNU make --jobs option in QMAKE

I am using qmake to generate MinGW32 Makefiles for a small Qt C++ app we are developing. My problem: all those dual/quad core CPUs are sitting there idly while only one thread is doing the building. In order to parallelize things I tried passing --jobs 4 to make, but the problem is that qmake generates a generic makefile inside of which make gets called again with -f .
Is it possible to force qmake to add options to make when generating the makefile? Or maybe there's another way of setting the option outside of qmake altogether? I can't edit that specific Makefile since it's autogenerated each build.
Abusing $MAKE to pass options does not work in all cases. Oftentimes, (e.g. in the configure script of Qt on Unix), it's enclosed in double quotes ("$MAKE") to allow the command to contain spaces. I know because I used the same trick before it stopped working. Qt Support then suggested (rightfully) to use $MAKEFLAGS as in
set MAKEFLAGS=-j4
make
This works for me:
set MAKE_COMMAND=mingw32-make -j%NUMBER_OF_PROCESSORS%
The generic Makefile uses $(MAKE) when invoking make, so you can overwrite it using environment variables. Something like this should do it:
qmake
make MAKE="mingw32-make -j4"
Replace the values of MAKE as required of course :)

Resources