Where are the environment variables in Docker containers coming from? - c#

I have made a Docker installation for a C# application, and I'm having some issues with the environment (more especially the DOTNET_VERSION, but also the others as can be seen in the "Inspect" tab of Docker-compose). In order to understand the whole situation, I would like to know where the Docker installation gets the mentioned information from. (I didn't find anything in the C# Visual Studio *.csproj file, nor in the Docker(-compose) related *.yml files.)
This is what the current "Inspect" page looks like:
Environment
--------
--------------
DOTNET_USE_POLLING_FILE_WATCHER
1
ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS
true
ASPNETCORE_ENVIRONMENT
Development
ASPNETCORE_URLS
https://+:443;http://+:80
NUGET_PACKAGES
/root/.nuget/fallbackpackages5
NUGET_FALLBACK_PACKAGES
/root/.nuget/fallbackpackages;...;/root/.nuget/fallbackpackages5
PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DOTNET_RUNNING_IN_CONTAINER
true
DOTNET_VERSION
5.0.17
ASPNET_VERSION
5.0.17
Mounts
--------
--------------
/APP
C:\Firm\Projecten...\Server\Connections\ConnectionsSvc
/REMOTE_DEBUGGER
C:\Users\Usr\vsdbg\vs2017u5
/SRC
/run/desktop/mnt/host/c/Firm/Projecten/.../AnotherSvc
/ROOT/.NUGET/FALLBACKPACKAGES4
C:\Program Files\dotnet\sdk\NuGetFallbackFolder
/ROOT/.NUGET/FALLBACKPACKAGES5
C:\Users\Usr.nuget\packages\
/ROOT/.ASPNET/HTTPS
C:\Users\Usr\AppData\Roaming\ASP.NET\Https
/ROOT/.MICROSOFT/USERSECRETS
C:\Users\Usr\AppData\Roaming\Microsoft\UserSecrets
/ROOT/.NUGET/FALLBACKPACKAGES
C:\Program Files (x86)\DevExpress 21.2\Components\Offline Packages
/ROOT/.NUGET/FALLBACKPACKAGES2
C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages
/ROOT/.NUGET/FALLBACKPACKAGES3
C:\Program Files (x86)\Progress\ToolboxNuGetPackages
Ports
--------
--------------
443/tcp
0.0.0.0:49154
80/tcp
0.0.0.0:5128
Edit after comments from Benoit.Be:
Pardon my ignorance, but I have no idea where to look for the FROM ... entry you mention.
I'll show you what my "DockerCompose" directory looks like (it's on a Windows computer, but I use a WSL for launching commandline commands):
Prompt> ls -ltra
total 12
-rwxrwxrwx 1 usr usr 5602 Oct 4 09:44 docker-compose.yml
drwxrwxrwx 1 usr usr 4096 Oct 4 09:47 mssqlserver
drwxrwxrwx 1 usr usr 4096 Oct 4 09:47 elasticsearch
drwxrwxrwx 1 usr usr 4096 Oct 4 09:47 rabbitmq
drwxrwxrwx 1 usr usr 4096 Oct 10 11:24 .
-rwxrwxrwx 1 usr usr 1713 Oct 10 11:24 docker-compose.base.yml
drwxrwxrwx 1 usr usr 4096 Oct 10 11:25 Envoy
drwxrwxrwx 1 usr usr 4096 Nov 22 09:33 ..
Prompt> find ./ -maxdepth 3 -type d
./
./elasticsearch
./elasticsearch/data
./elasticsearch/data/nodes
./Envoy
./mssqlserver
./mssqlserver/data
./rabbitmq
./rabbitmq/data
./rabbitmq/data/mnesia
./rabbitmq/log
Where can I look for the mentioned information?
Oh, I've launched a "find in file(s)", looking for the "FROM" keyword, and I found something in the "Envoy" container. Does this mean that that "Envoy" container is what you call the base image?
Here's the entry:
./Envoy/Dockerfile:FROM envoyproxy/envoy-dev:9105f45c7fb872d1db2bf8q9bc608368effe77cd

Related

Missing "Microsoft.CodeAnalysis" in .net 3.1 install on Ubuntu

I have a .net project that runs in windows with VS code with no issues.
I am trying to run the same project in Ubuntu 20.04.2 with VS code. Run trying to run it with F5, I get the errors:
CSC : error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=****'. The system cannot find the file specified.. [/home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj]
CSC : error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=******'. The system cannot find the file specified.. [/home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj]
I verified the files are on my system:
roslyn3.11
% lr /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll
-rwxrw-r-- 1 one one 148K Aug 19 19:48 /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll
roslyn4.0
one#work ~
% lr /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll
-rwxrw-r-- 1 one one 164K Aug 19 19:48 /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll
csproj
one#work ~
% lr /home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj
-rw-rw-r-- 1 one one 1.8K Nov 10 16:59 /home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj
It looks like "Microsoft.CodeAnalysis" was missing. So, I installed it with nuget in VS code. I added 'nuget: add package' in VS code to install 'Microsoft.CodeAnalaysis' version 3.11.0.
I have verified it successfully lives on my system:
one#work ...packages/microsoft.codeanalysis/3.11.0
% pwd
/home/one/.nuget/packages/microsoft.codeanalysis/3.11.0
one#work ...packages/microsoft.codeanalysis/3.11.0
% lr
total 80K
drwxrwxr-x 2 one one 4.0K Nov 14 10:08 .
drwxrwxr-x 4 one one 4.0K Nov 14 10:08 ..
-rw-rw-r-- 1 one one 178 Nov 14 10:08 .nupkg.metadata
-rwxrw-r-- 1 one one 19K Aug 10 2021 .signature.p7s
-rwxrw-r-- 1 one one 6.9K Apr 30 2021 Icon.png
-rwxrw-r-- 1 one one 2.2K Aug 3 2021 ThirdPartyNotices.rtf
-rw-rw-r-- 1 one one 28K Nov 14 10:08 microsoft.codeanalysis.3.11.0.nupkg
-rw-rw-r-- 1 one one 88 Nov 14 10:08 microsoft.codeanalysis.3.11.0.nupkg.sha512
-rwxrw-r-- 1 one one 2.4K Aug 3 2021 microsoft.codeanalysis.nuspec
I still get the errors mentioned above.

Progress OpenEdge ERROR [60] [DataDirect][ODBC 20101 driver]6013

I have issue when trying to connect to a progress openedge database using odbc. The client code is in c# and running in docker. Here is my code :
using (OdbcConnection cn = new OdbcConnection("DSN=PROGRESS;UID=username;PWD=pass;"))
{
cn.Open();
}
The issue is that program is crashing at the cn.Open() with the following error : ERROR [60] [DataDirect][ODBC 20101 driver]6013.
I can successfully connect using isql -v PROGRESS username pass and I can query tables.
Environnement :
It is a .NET Core app on a docker environment. Here is my odbc.ini file :
[PROGRESS]
Driver=/usr/lib/x86_64-linux-gnu/pgoe27.so
HostName=192.168.2.11
DatabaseName=dbname
LogonID=username
Password=pass
PortNumber=20000
[ODBC]
Trace=0
TraceFile=odbctrace.out
TraceDll=/usr/lib/openedge/lib/pgtrc27.so
InstallDir=/usr/lib/openedge
I do not understand why I can connect using isql but not using c# OdbcConnection...
Thanks in advance
EDITED
Here is my odbc folder permissions :
# ls -l lib
total 27124
-rwxr-xr-x 1 root root 1782648 Aug 2 13:09 libodbc.so
-rwxr-xr-x 1 root root 1280424 Aug 2 13:09 libodbcinst.so
-rwxr-xr-x 1 root root 14682952 Aug 2 13:09 libpgicu27.so
-rwxr-xr-x 1 root root 1468736 Aug 2 13:09 libpgmback.so
-rwxr-xr-x 1 root root 2351288 Aug 2 13:09 libpgssl27.so
-rwxr-xr-x 1 root root 1586488 Aug 2 13:09 odbccurs.so
-rwxr-xr-x 1 root root 2871272 Aug 2 13:09 pgoe27.so
-rwxr-xr-x 1 root root 1667632 Aug 2 13:09 pgtrc27.so
-rwxr-xr-x 1 root root 63800 Aug 2 13:09 vscnctdlg.so
# ls -lR locale
locale:
total 8
drwxrwxrwx 1 root root 4096 Aug 2 13:09 en_US
locale/en_US:
total 4
drwxrwxrwx 1 root root 4096 Aug 2 13:09 LC_MESSAGES
locale/en_US/LC_MESSAGES:
total 208
-rw-rw-r-- 1 root root 36241 Aug 2 13:09 odbc.m
-rw-rw-r-- 1 root root 19099 Aug 2 13:09 odbc.po
-rw-rw-r-- 1 root root 19096 Aug 2 13:09 pgmback.mo
-rw-rw-r-- 1 root root 11581 Aug 2 13:09 pgmback.po
-rw-rw-r-- 1 root root 72722 Aug 2 13:09 pgoe27.mo
-rw-rw-r-- 1 root root 47627 Aug 2 13:09 pgoe27.po
I have managed connecting specifying connection in my .net program, but I still cannot using DSN + odbc.ini :
OdbcConnectionStringBuilder builder = new OdbcConnectionStringBuilder
{
Driver = "/usr/lib/openedge/lib/pgoe27.so",
};
builder.Add("HostName", "192.168.2.11");
builder.Add("DatabaseName", "PROGRESS");
builder.Add("LogonID", "username");
builder.Add("Password", "password");
builder.Add("PortNumber", "20000");
using (OdbcConnection cnGlims = new OdbcConnection(builder.ConnectionString))
{
cnGlims.Open();
}
According to the Progress Knowledgebase the fact that you are getting error numbers (60, 6013) rather than an error message indicates a configuration problem preventing the message description files from being loaded.
https://knowledgebase.progress.com/articles/Knowledge/3556 says:
Cause: The ODBC driver manager and/or the ODBC driver library cannot
load its message files.
InstallDir is not set correctly in the [ODBC] section of the odbc.ini
file or the message files in locale/en_US/LC_MESSAGES are missing.
Make sure the following are set correctly:
Set the environment variable LANG to en_US :
export LANG=en_US (ksh shell)
setenv LANG en_US (csh shell)
Ensure that the environment variable ODBCINI (or ODBC_INI) is pointing
to the proper odbc.ini file
Ensure that in the [ODBC] section of your odbc.ini file the correct
installation path of the ODBC drivers is specified for InstallDir
e.g. InstallDir=/opt/odbc
Make sure the .mo / .po messages files exist
(odbcinstaldir/locale/en_US/LC_MESSAGES) and can be loaded by your
application
If your installDir is /usr/lib/openedge then you should test for the existence (and permissions) of these files like so:
$ cd /usr/lib/openedge
$ ls -l ./odbc/lib
total 29832
-rwxrwxr-x. 1 root root 1676480 Jan 21 2020 libodbcinst.so
-rwxrwxr-x. 1 root root 2182544 Jan 21 2020 libodbc.so
-rwxrwxr-x. 1 root root 14682952 Jan 21 2020 libpgicu27.so
-rwxrwxr-x. 1 root root 1977640 Jan 21 2020 libpgmback.so
-rwxrwxr-x. 1 root root 2359016 Jan 21 2020 libpgssl27.so
-rwxrwxr-x. 1 root root 2065616 Jan 21 2020 odbccurs.so
-rwxrwxr-x. 1 root root 3383128 Jan 21 2020 pgoe27.so
-rwxrwxr-x. 1 root root 2142864 Jan 21 2020 pgtrc27.so
-rwxrwxr-x. 1 root root 63800 Jan 21 2020 vscnctdlg.so
$ ls -lR ./odbc/locale
./odbc/locale:
total 0
drwxrwxrwx. 3 root root 25 Apr 10 2020 en_US
./odbc/locale/en_US:
total 0
drwxrwxrwx. 2 root root 105 Apr 10 2020 LC_MESSAGES
./odbc/locale/en_US/LC_MESSAGES:
total 212
-rw-rw-r--. 1 root root 36241 Jan 21 2020 odbc.m
-rw-rw-r--. 1 root root 19099 Jul 29 2011 odbc.po
-rw-rw-r--. 1 root root 19096 Jan 21 2020 pgmback.mo
-rw-rw-r--. 1 root root 11581 Jul 29 2011 pgmback.po
-rw-rw-r--. 1 root root 74007 Jan 21 2020 pgoe27.mo
-rw-rw-r--. 1 root root 49045 Jan 21 2020 pgoe27.po

unable to do multiple matches with regex pattern. pattern treats as a single match [duplicate]

This question already has answers here:
My regex is matching too much. How do I make it stop? [duplicate]
(5 answers)
Closed 3 years ago.
I'm trying to match a pattern out of text which repeats with in the text. when i try match pattern it matches whatever in between. though I achieved the desired result but i might want any optimization in my regex pattern if possible. please suggest.
this is the text content...
$text = #"
Microsoft (R) Windows Debugger Version 6.3.9600.17336 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
Loading Dump File [C:\Windows\MEMORY.DMP]
Kernel Summary Dump File: Only kernel address space is available
************* Symbol Path validation summary **************
Response Time (ms) Location
Deferred srv*DownstreamStore*https://msdl.microsoft.com/download/symbols
************* Symbol Path validation summary **************
Response Time (ms) Location
Deferred srv*DownstreamStore*https://msdl.microsoft.com/download/symbols
Symbol search path is: srv*DownstreamStore*https://msdl.microsoft.com/download/symbols
Executable search path is:
Windows 7 Kernel Version 7600 UP Free x64
Product: LanManNt, suite: SmallBusiness TerminalServer SmallBusinessRestricted SingleUserTS
Built by: 7600.16385.amd64fre.win7_rtm.090713-1255
Machine Name:
Kernel base = 0xfffff800`01658000 PsLoadedModuleList = 0xfffff800`01895e50
Debug session time: Tue Apr 16 04:27:05.412 2019 (UTC - 7:00)
System Uptime: 7 days 1:02:26.286
Loading Kernel Symbols
...............................................................
..............................................Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
..................
.........
Loading User Symbols
PEB is paged out (Peb.Ldr = 000007ff`fffdb018). Type ".hh dbgerr001" for details
Loading unloaded module list
....
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyze -v to get detailed debugging information.
BugCheck D1, {fffff8a0032dd010, 2, 0, fffff8800567d530}
*** ERROR: Module load completed but symbols could not be loaded for myfault.sys
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : myfault.sys ( myfault+1530 )
Followup: MachineOwner
---------
----- 64 bit Kernel Summary Dump Analysis
DUMP_HEADER64:
MajorVersion 0000000f
MinorVersion 00001db0
KdSecondaryVersion 00000000
DirectoryTableBase 00000000`cadb0000
PfnDataBase fffffa80`00000000
PsLoadedModuleList fffff800`01895e50
PsActiveProcessHead fffff800`01877b30
MachineImageType 00008664
NumberProcessors 00000001
BugCheckCode 000000d1
BugCheckParameter1 fffff8a0`032dd010
BugCheckParameter2 00000000`00000002
BugCheckParameter3 00000000`00000000
BugCheckParameter4 fffff880`0567d530
KdDebuggerDataBlock fffff800`01841070
SecondaryDataState 00000000
ProductType 00000002
SuiteMask 00000131
SUMMARY_DUMP64:
DumpOptions 504d4453
HeaderSize 00024000
BitmapSize 00108000
Pages 00013cb0
Bitmap.SizeOfBitMap 00108000
KiProcessorBlock at fffff800`01900900
1 KiProcessorBlock entries:
fffff800`01842e80
Windows 7 Kernel Version 7600 UP Free x64
Product: LanManNt, suite: SmallBusiness TerminalServer SmallBusinessRestricted SingleUserTS
Built by: 7600.16385.amd64fre.win7_rtm.090713-1255
Machine Name:
Kernel base = 0xfffff800`01658000 PsLoadedModuleList = 0xfffff800`01895e50
Debug session time: Tue Apr 16 04:27:05.412 2019 (UTC - 7:00)
System Uptime: 7 days 1:02:26.286
start end module name
fffff800`0142c000 fffff800`01436000 kdcom Mon Jul 13 18:31:07 2009 (4A5BDFDB)
fffff800`0160f000 fffff800`01658000 hal Mon Jul 13 18:27:36 2009 (4A5BDF08)
fffff800`01658000 fffff800`01c35000 nt Mon Jul 13 16:40:48 2009 (4A5BC600)
fffff880`00c00000 fffff880`00c3c000 vmbus Mon Jul 13 16:42:54 2009 (4A5BC67E)
###
some similar text just to save characters
###
fffff960`00050000 fffff960`0035f000 win32k Mon Jul 13 16:40:16 2009 (4A5BC5E0)
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
fffff960`004c0000 fffff960`004de000 dxg Mon Jul 13 16:38:28 2009 (4A5BC574)
fffff960`00620000 fffff960`0062a000 TSDDD Mon Jul 13 17:16:34 2009 (4A5BCE62)
fffff960`008c0000 fffff960`008cb000 VMBusVideoD Mon Jul 13 16:43:00 2009 (4A5BC684)
fffff960`00af0000 fffff960`00b26000 RDPDD Mon Jul 13 17:16:54 2009 (4A5BCE76)
Unloaded modules:
fffff880`018e5000 fffff880`018f3000 crashdmp.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0000E000
fffff880`018f3000 fffff880`018ff000 dump_ataport.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0000C000
fffff880`018ff000 fffff880`01908000 dump_atapi.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 00009000
fffff880`00de5000 fffff880`00e00000 sacdrv.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0001B000
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyze -v to get detailed debugging information.
BugCheck D1, {fffff8a0032dd010, 2, 0, fffff8800567d530}
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : myfault.sys ( myfault+1530 )
Followup: MachineOwner
---------
Finished dump check
"#
This should return 2 possible matches
([regex]"(?ms)\*{20,}.+-{8,}").Matches($text)
but gives this..
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyze -v to get detailed debugging information.
BugCheck D1, {fffff8a0032dd010, 2, 0, fffff8800567d530}
*** ERROR: Module load completed but symbols could not be loaded for myfault.sys
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : myfault.sys ( myfault+1530 )
Followup: MachineOwner
---------
----- 64 bit Kernel Summary Dump Analysis
DUMP_HEADER64:
MajorVersion 0000000f
MinorVersion 00001db0
KdSecondaryVersion 00000000
DirectoryTableBase 00000000`cadb0000
PfnDataBase fffffa80`00000000
PsLoadedModuleList fffff800`01895e50
PsActiveProcessHead fffff800`01877b30
MachineImageType 00008664
NumberProcessors 00000001
BugCheckCode 000000d1
BugCheckParameter1 fffff8a0`032dd010
BugCheckParameter2 00000000`00000002
BugCheckParameter3 00000000`00000000
BugCheckParameter4 fffff880`0567d530
KdDebuggerDataBlock fffff800`01841070
SecondaryDataState 00000000
ProductType 00000002
SuiteMask 00000131
SUMMARY_DUMP64:
DumpOptions 504d4453
HeaderSize 00024000
BitmapSize 00108000
Pages 00013cb0
Bitmap.SizeOfBitMap 00108000
KiProcessorBlock at fffff800`01900900
1 KiProcessorBlock entries:
fffff800`01842e80
Windows 7 Kernel Version 7600 UP Free x64
Product: LanManNt, suite: SmallBusiness TerminalServer SmallBusinessRestricted SingleUserTS
Built by: 7600.16385.amd64fre.win7_rtm.090713-1255
Machine Name:
Kernel base = 0xfffff800`01658000 PsLoadedModuleList = 0xfffff800`01895e50
Debug session time: Tue Apr 16 04:27:05.412 2019 (UTC - 7:00)
System Uptime: 7 days 1:02:26.286
start end module name
fffff800`0142c000 fffff800`01436000 kdcom Mon Jul 13 18:31:07 2009 (4A5BDFDB)
fffff800`0160f000 fffff800`01658000 hal Mon Jul 13 18:27:36 2009 (4A5BDF08)
fffff800`01658000 fffff800`01c35000 nt Mon Jul 13 16:40:48 2009 (4A5BC600)
fffff880`00c00000 fffff880`00c3c000 vmbus Mon Jul 13 16:42:54 2009 (4A5BC67E)
fffff880`00c3c000 fffff880`00c66000 ataport Mon Jul 13 16:19:52 2009 (4A5BC118)
####
Some similar text just to save characters
####
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
fffff960`004c0000 fffff960`004de000 dxg Mon Jul 13 16:38:28 2009 (4A5BC574)
fffff960`00620000 fffff960`0062a000 TSDDD Mon Jul 13 17:16:34 2009 (4A5BCE62)
fffff960`008c0000 fffff960`008cb000 VMBusVideoD Mon Jul 13 16:43:00 2009 (4A5BC684)
fffff960`00af0000 fffff960`00b26000 RDPDD Mon Jul 13 17:16:54 2009 (4A5BCE76)
Unloaded modules:
fffff880`018e5000 fffff880`018f3000 crashdmp.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0000E000
fffff880`018f3000 fffff880`018ff000 dump_ataport.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0000C000
fffff880`018ff000 fffff880`01908000 dump_atapi.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 00009000
fffff880`00de5000 fffff880`00e00000 sacdrv.sys
Timestamp: unavailable (00000000)
Checksum: 00000000
ImageSize: 0001B000
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyze -v to get detailed debugging information.
BugCheck D1, {fffff8a0032dd010, 2, 0, fffff8800567d530}
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : myfault.sys ( myfault+1530 )
Followup: MachineOwner
---------
but I ended up doing this to get the second part which is successful
$text -match [regex]"(?ms)\*{20,}.+-{8,}\s+\n+-.+\n(^\*{20,}.+\*\s+[bB].+\*{20,}.+-{8,})"
$Matches[1]
Desired Result is only second part
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyze -v to get detailed debugging information.
BugCheck D1, {fffff8a0032dd010, 2, 0, fffff8800567d530}
Page eb21d not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : myfault.sys ( myfault+1530 )
Followup: MachineOwner
---------
You can do this with your first regex slightly altered to use a lazy quantifier .*?. Then select the second indexed value [1] of your two matches.
([regex]"(?ms)\*{20,}.*?-{8,}").matches($text).value[1]
If you want both matches, then just leave off the index:
([regex]"(?ms)\*{20,}.*?-{8,}").matches($text).value

Regex to parse FTP server list C#

I'm using Regex list to parse FTP server listing. I'm not good with Regex at all, this is list of regex I collected online to parse various server FTP outputs:
private static readonly string[] DirectoryParseFormats =
{
"(?<dir>[\\-d])(?<permission>([\\-r][\\-w][\\-xs]){3})\\s+\\d+\\s+\\w+\\s+\\w+\\s+(?<size>\\d+)\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{4})\\s+(?<name>.+)",
"(?<dir>[\\-d])(?<permission>([\\-r][\\-w][\\-xs]){3})\\s+\\d+\\s+\\d+\\s+(?<size>\\d+)\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{4})\\s+(?<name>.+)",
"(?<dir>[\\-d])(?<permission>([\\-r][\\-w][\\-xs]){3})\\s+\\d+\\s+\\d+\\s+(?<size>\\d+)\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{1,2}:\\d{2})\\s+(?<name>.+)",
"(?<dir>[\\-d])(?<permission>([\\-r][\\-w][\\-xs]){3})\\s+\\d+\\s+\\w+\\s+\\w+\\s+(?<size>\\d+)\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{1,2}:\\d{2})\\s+(?<name>.+)",
"(?<dir>[\\-d])(?<permission>([\\-r][\\-w][\\-xs]){3})(\\s+)(?<size>(\\d+))(\\s+)(?<ctbit>(\\w+\\s\\w+))(\\s+)(?<size2>(\\d+))\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{2}:\\d{2})\\s+(?<name>.+)",
"(?<timestamp>\\d{2}\\-\\d{2}\\-\\d{2}\\s+\\d{2}:\\d{2}[Aa|Pp][mM])\\s+(?<dir>\\<\\w+\\>){0,1}(?<size>\\d+){0,1}\\s+(?<name>.+)"
};
Now I stumbled upon following output from odd FTP server. What's weird is that server outputs file name together with folder name for some reason.
Anyway, I'd like to have similar RegEx for this string, ideally introduce folder name to separate it out, String returned by server is what's inside pipes |
|-rw-rw-rw- 1 generic 235 Mar 22 11:21 fromDoder/DOD997ABCD.20170322112114159.1961812284.txt|
EDIT:
Here is C# code I use to iterate through regex expressions to pick one that matches FTP server output. Then I use it to parse out file name and type
// Use our regex library to parse
match = DirectoryParseFormats.Select(dpf => new Regex(dpf).Match(raw)).FirstOrDefault(m => m.Success);
if (match == null) throw new Exception($"Can't parse FTP directory list item. raw item: |{raw}|, whole response: |{response}|");
// If not directory - this is file
var dir = match.Groups["dir"].Value;
if (dir == string.Empty || dir == "-") list.Add(match.Groups["name"].Value);
EDIT 2:
total 0
drw-rw-rw- 1 user group 0 Apr 23 2016 .
drw-rw-rw- 1 user group 0 Apr 23 2016 ..
EDIT 3:
var hintRegex = #"^
(?<dir>[-d])
(?<permission>(?:[-r][-w][-xs]){3})
\s+\d+
\s+\w+
(?:\s+\w+)?
\s+(?<size>\d+)
\s+(?<timestamp>\w+\s+\d+(?:\s+\d+(?::\d+)?))
\s+(?!(?:\.|\.\.)\s*$)(?<name>.+?)\s*
$";
Match match = new Regex(hintRegex).Match("-rw-r--r-- 1 ftp ftp 1079 Apr 06 2017 LEANCOR_040617084839.txt");
if (!match.Success) Debug.WriteLine("Doesn't match");
Since your pattern looks like you're trying to match the output of ls -l, as well as you mentioning it's a list command. I'm assuming it is so.
The main problem I could gather from your code is that you're missing the multiline flag (RegexOptions.Multiline).
Your regex overall seems correct, I only did a few changes. Here's it layed out with a bit of spacing (which still works if you use the extended flag).
^
(?<dir>[-d])
(?<permission>(?:[-r][-w][-xs]){3})
\s+\d+
\s+\w+
(?:\s+\w+)?
\s+(?<size>\d+)
\s+(?<timestamp>\w+\s+\d+(?:\s+\d+(?::\d+)?))
\s+(?!(?:\.|\.\.)\s*$)(?<name>.+?)\s*
$
Here's a live preview.
You can test it by doing:
string pattern = #"^(?<dir>[-d])(?<permission>(?:[-r][-w][-xs]){3})\s+\d+\s+\w+(?:\s+\w+)?\s+(?<size>\d+)\s+(?<timestamp>\w+\s+\d+(?:\s+\d+(?::\d+)?))\s+(?!(?:\.|\.\.)\s*$)(?<name>.+?)\s*$";
Regex re = new Regex(pattern, RegexOptions.Multiline);
string source = #"
-rwxr-xr-x 1 root 46789 Feb 7 23:15 certbot-auto
drwxr-xr-x 2 root 4096 Mar 22 16:29 test dir
drwxr-xr-x 4 root 4096 Feb 10 15:50 www
-rw-rw-rw- 1 generic 235 Mar 22 11:21 fromDoder/DOD997ABCD.20170322112114159.1961812284.txt
-rw-rw-rw- 1 cmuser cmuser 904 Mar 23 15:04 20170323110427785_3741647.edi
drw-rw-rw- 1 user group 0 Apr 23 2016 .
drw-rw-rw- 1 user group 0 Apr 23 2016 ..
drw-rw-rw- 1 user group 0 Apr 23 2016 .cache
drw-rw-rw- 1 user group 0 Apr 23 2016 .bashrc
";
MatchCollection matches = re.Matches(source);
Console.WriteLine(matches.Count);
foreach (Match match in matches)
{
Console.WriteLine(match.Groups["dir"]);
Console.WriteLine(match.Groups["permission"]);
Console.WriteLine(match.Groups["size"]);
Console.WriteLine(match.Groups["timestamp"]);
Console.WriteLine(match.Groups["name"]);
Console.WriteLine();
}
Note that the content of source is just an edited version of the output of ls -l on my server (with the addition of your example). So if my assumptions are correct, it should look familiar to you.
Edit: Based on your comment, you simply need to remove one of the \s+\w+ (I've updated all the above to reflect that).
The regex for the given string input goes as under:
(?<permission>([\\-rwxs]+){3})\\s+\\d+\\s+\\w+\\s+(?<size>\\d+)\\s+(?<timestamp>\\w+\\s+\\d+\\s+\\d{1,2}:\\d{1,2})\\s+(?<folder>\\w+\\/)?(?<name>.+)
The online regex test including regex pattern and the given input string is shown in the image below.

Not able to see the final result after the Reduce function got executed using Windows Azure Storage in MapReduce

I am using c#.net for writing the map and reduce function.I have basically followed the example being given here
Final command
Hadoop jar hadoop-streaming.jar -files "hdfs:///example/apps/map.exe,hdfs:///example/apps/reduce.exe" -input "/example/apps/data.csv" -output "/example/apps/output.txt" -mapper "map.exe" -reducer "reduce.exe"
The Job ran successfully
Now from the Interactive JS mode, if I write
js> #cat /example/apps/output.txt
cat: File does not exist: /example/apps/output.txt
Where as :
js> #ls /example/apps/output.txt
Found 3 items
-rw-r--r-- 3 xxxx supergroup 0 2013-02-22 10:23 /example/apps/output.txt/_SUCCESS
drwxr-xr-x - xxxx supergroup 0 2013-02-22 10:22 /example/apps/output.txt/_logs
-rw-r--r-- 3 xxxx supergroup 0 2013-02-22 10:23 /example/apps/output.txt/part-00000
What is the mistake I am making and how can I see the output?
The -output flag specifies an output folder, not a file. Since there can be multiple reducers, each one will produce a file in this folder.
In this case, you have one reducer, and it produced one file: part-00000. If there were more reducers, they would be named part-00001, part-00002, etc.
The command cat /example/apps/output.txt/part-00000 will display your output. In the future, don't name your output folders something.txt, as that will just confuse you and others :)

Categories