Why is the variable PS1 a problem for direnv when sourcing venv - python-venv

I use direnv v2.21.2 and want that the hook activates my previous created .venv. If I use just source .venv/bin/activate my environment gets activated, but PS1 reacts with an error message. I actually have no clue what to do with the PS1 variable but it seems not a big issue since I use starshipas my prompt. Not completly shure.
Using instead layout python3 works fine without error but creates the extra venv which I don't need. Any Ideas?
EDIT: The Error Message which is produced by direnv if unset PS1 is not used:
direnv: PS1 cannot be exported. For more information see https://github.com/direnv/direnv/wiki/PS1
The Message leads actually to the correct information, but doesn't help much about why the problem exist.

It seems exporting PS1 triggered a bug in Bash 3.0, and direnv did not have a way to set certain variable instead of exporting them. I don't know what bug in Bash was triggered exactly.
Interesting. I have another variable [like CDPATH –ed] that would best be set instead of exported: PS1. Direnv doesn't really have a mechanism for that. If I get around to rewrite direnv I will take that into account.
— zimbatm commented on issue 251 on Mar 11, 2017
PS1 is on the direnv blacklist because of a bug in bash 3.x — zimbatm commented on issue 331 on Feb 20, 2018
// PS1 should not be exported, fixes problem in bash — comment in env_diff.go

Related

nuget command Source Add started to fail out of nowhere with a warning asking for a unique source

I have an c# wpf application and an additional installer project to create an installer of the application. Among many other files, the installer project has a installer.cmd file (I took over it from someone else) and a Product.wxs file. I was able to create an installer by running msbuild tools\installer.cmd /P:Library=net461 /P:Platform=x64 command on the developper comand prompt.
I was trying to create a desktop shortcut in all user's desktops and was playing with *.wxs file for that. I know you guys will roast me because of the following sentence but I don't know what else can I say. Something I did break something and somehow the msbuild starts to give error. I cannot say what I did because I tried many different things.. I went back to original project but it didn't help. So what is done is done. I will talk about the error now.
The error itself doesn't tell much:
C:\workspace\QToolInstaller\tools\installer.cmd(117,5): error MSB3073: The command "nuget Source Add -Name PkgSrc_638107674121812897 -Source C:\workspace\QToolInstaller\exports" exited with code 1.
I checked online to understand this error code but there wasn't much. However there is another line just before this erorr line:
The source specified has already been added to the list of available package sources. Provide a unique source.
Well, this wasn't in usual warning color or marked as a warning. But I think it is worth to investigate.
So the "source" mentioned here is PkgSrc_638107674121812897. I scanned the installer.cmd to see where is this coming form and saw that this file is named by using time ticks as:
<LocalSource>PkgSrc_$([System.DateTime]::UtcNow.Ticks)</LocalSource>
Although I ran the msbuild command multiple times, the name of the source is always different. I ran the command in diagnostic mode by using -verbosity:diag option. And I checked the file name among all the logs. There is no match. I tried to change the name to something ridicolous that cannot be listed anywhere but got the same error. Removed alll the files, created them again, restarted the PC etc. Nothing have changed. This name is really unique and but still I am getting this message. I wish I had logs form previous successfull runs. I cannot tell if this is the cause of the failure or not. Does any of these ring any bell fellas?
It is solved! Luckily a colleague of mine have faced with this before. I hope no one will have to deal with this problem again.
So apparently there is a bug(?). Altought that name is unique it thinks the opposite. When I do list the sources with thw followng command
nuget source
among the one that should be there, there is one extra line as PkgSrc_638107643440982987. Although my installer.cmd suppose to remove the source every time after it is done, it didn't for once. And although the new source is named differently, it doesn't care and gives that non-warning, non-error message followed by a meaningless error code 1 message. How to solve it?
We tried to remove the source by command prompt like this:
nuget source delete -Name PkgSrc_638107643440982987
But it is not deleted. So we went to the Visual Studio->Tools->NuGet Package Manager->Package Manager Settings->Package Sources. Found the guilty source and remove it. And then it is resolved.

How to change redis source code?

I am making changes in the redis source code so that everytime the user sets a key, instead of printing "OK" it prints something else.
But this change is not getting reflected.
I also tried uninstalling redis, modifying the redis source code and then installing it again. But still it doesnt work.
Does it need to be compiled or something?
https://www.heychinaski.com/blog/2013/10/14/a-look-at-the-redis-source-code/comment-page-1/ This should help you change redis code. Here there is an excellent example given. They have added a new command "rand" to redis command set.
I'll summarize the steps to add a command in redis :
In redisCommandTable, you need to add the specifications of the new command- the command name, its args etc.
Then you need to define a prototype of the function that will be called when this command is executed in src/redis.h
Define the function in src/redis.c.
Give 'make' to compile.

Cancel command in Grunt that hasn't been launched

In Pig Grunt, if I make a mistake in my command (for instance not closing a '), it shows a new prompt until the command is fixed:
grunt> tmp = LOAD '/mapred/data;
>>
In the case above, adding '; would solve it, but sometimes the command is long and complex, and finding the culprit proves difficult.
Is there a way to cancel the current entry without exiting Pig altogether? I.e., not ctrl+C or ctrl+D?
Note: I know it's similar to this question how to cancel command in GRUNT shell, but in my case the command hasn't been launched yet.
Corresponding to your example, I realized one way of exiting is to complete the line which is open due to the single quote. Therefore in this case I added the following in the next line and it quit with an error.
>> ';
Not sure if there is an easier way to do this, more so because the grunt shell is still not very developed. In any case, I hope there is a better workaround for this soon.

execute system command on rails - not working in production

On development everything works great. On production however, this line of code in a controller is no working:
output = `mclines #{paramFileName} #{logFileName} #{outputFileName}`
where mclines is a c program, and the rest are names of files. mclines is not executed on the production server, but it does on my laptop. I have no idea about what to fix. Have been trying different things for hours, but the truth is that I'm quite lost. In production the ssl in on, that's the only major difference.
If I execute the command on the shell, it gets executed. When I say it doesn't gets executed is because the first thing it should do is print some info in a file, and it doesn't. The server -as my laptop- is running ubuntu, but I have no idea about what logs could be usefull to read. systemlog had nothing usefull.
Any ideas that can lead to find the culprit are welcome.
Make sure mclines really exists on the production server, and use the full path to the mclines executable, as in
output = `/full/path/to/mclines #{paramFileName} #{logFileName} #{outputFileName}`.
Reference this
Try to print out your exit status code as:
$?.to_i
after the command...
or as pointed out in this link you can always use popen3/popen4 for better handling of input/output for system commands...

Mono Migration Analyzer: What are all of the command line switches?

So I'm looking here and I see the command line switches. http://mono-project.com/Command_Line_MoMA
This is what I see as the total amount of switches from the site:
MoMA.exe --nogui --out C:\app\momareport\report.html C:\app\myapp.exe
One thing I see is the submit.xml going to a place I don't want during my automated build. Since it is a generated file, I want to change where it goes. Is there a switch for that?
Also, what are all of the switches for it?
If there is not a switch for moving the submit.xml to a reporting location, please consider it for future versions.
EDIT: The argument --help does not work. I tried that and a host of others to try to get some dialog from MoMA on the command line. I'm on Windows to help alleviate any confusion.
Those are the only command line switches supported by MoMA. You can see the code here.
"MoMA.exe --help" does not work because MoMA is compiled as a winforms application so that the command window is not shown. As a result, MoMA disconnects from the command window, and therefore things like Console.WriteLine will not work.
To answer your actual question, there is currently not a way to change where the .xml file gets put.
You might want to try:
MoMA.exe --help
On Linux, there should also be a manpage.
If you can't find the feature, and want to submit it to Mono, you'll want to go via the Bugzilla page.