how to use an already generated tagfile with opengrok.jar in windows - ctags

I have downloaded and extracted opengrok in localsystem and have ctags.exe in the local system
I tried to execute the following command with those arguments and got the following response pasted below the linebreak.
java -jar opengrok.jar -W d:\opengrok-1.1-rc41\configuration.xml -P
-S -v -s d:\Projects\codebase -d d:\opengrok-1.1-rc41\grokdata -c d:\ctags\ctags.exe
D:\opengrok-1.1-rc41\lib>java -jar opengrok.jar -W
d:\opengrok-1.1-rc41\configuration.xml -P -S -v -s
d:\Projects\codebase -d d:\opengrok-1.1-rc41\grokdata -c
d:\ctags\ctags.exe Nov 28, 2018 7:23:52 PM
org.opengrok.indexer.index.Indexer parseOptions INFO: Indexer options:
[-W, d:\opengrok-1.1-rc41\configuration.xml, -P, -S, -v, -s,
d:\Projects\codebase, -d, d:\opengrok-1.1-rc41\grokdata, -c,
d:\ctags\ctags.exe] Logging filehandler pattern: %h/java%u.log Nov 28,
2018 7:23:52 PM org.opengrok.indexer.index.Indexer main INFO: Indexer
version 1.1-rc41 (fd2e8feba888a0b3c6938be7544aca3502695940) Nov 28,
2018 7:23:52 PM org.opengrok.indexer.configuration.RuntimeEnvironment
validateUniversalCtags SEVERE: Error: No Universal Ctags found !
(tried running d:\ctags\ctags.exe) Please use the -c option to specify
path to a Universal Ctags program. Or set it in Java system property
org.opengrok.indexer.analysis.Ctags Nov 28, 2018 7:23:52 PM
org.opengrok.indexer.index.Indexer main SEVERE: Exception running
indexer org.opengrok.indexer.index.IndexerException: Didn't find
Universal Ctags
at org.opengrok.indexer.index.Indexer.prepareIndexer(Indexer.java:888)
at org.opengrok.indexer.index.Indexer.main(Indexer.java:298)
Usage: java -jar opengrok.jar [options] [subDir1 [...]]
So, i executed [d:\ctags\ctags.exe -R -f d:\tagfile.txt] directly in the d:\projects\codebase fodler and got the tag file.
In this case how do i use an already indexed/tagged file(tagfile.txt) with opengrok ?

Have you the Universal Ctags installed?
The OpenGrok 1.1 requires the Universal Ctags accordingly with the Release Notes.

Related

npm package's binary accessible until I add flags

I'm on a mac am trying to install elasticdump. It is also worth noting that I am using zsh, but am getting the equivalent error described below when switching over to bash.
I just re-installed npm from scratch and am now using 6.12.0. After this, I ran npm install elasticdump -g which appears to have worked just fine.
$ which elasticdump
/usr/local/bin/elasticdump
It appears I am still having the same issue I was having before I tried re-installing everything.
I can run elasticdump directly with no issues. It tells me I need an input and an output as I would expect.
$ elasticdump
Sat, 09 Nov 2019 04:52:40 GMT | Error Emitted => {"errors":["`input` is a required input","`output` is a required input"]}
I can even run it with --help.
$ elasticdump --help
elasticdump: Import and export tools for elasticsearch
version: 6.15.7
...
But when I add an input and output, things fall apart!
$ elasticdump \
--input /Users/slant/Desktop/data.json \
--output http://localhost:9200/companies \
--type data
zsh: command not found: elasticdump
And in bash:
$ elasticdump \
> --input /Users/slant/Desktop/data.json \
> --output http://localhost:9200/companies \
> --type data
bash: elasticdump : command not found
I'm completely baffled as to how adding specific flags causes it to become completely inaccessible! Any help at all would be greatly appreciated.
Edit: In case anyone requests this:
$ ls -la /usr/local/bin/elasticdump
lrwxr-xr-x 1 slant admin 47 Oct 1 20:42 /usr/local/bin/elasticdump -> ../lib/node_modules/elasticdump/bin/elasticdump
Accessing the binary through the file directly behaves exactly the same way as using just elasticdump by itself.
Updated, for clarification.
/usr/local/lib/node_modules/elasticdump/bin/elasticdump
Sat, 09 Nov 2019 18:40:56 GMT | Error Emitted => {"errors":["`input` is a required input","`output` is a required input"]}
$ /usr/local/lib/node_modules/elasticdump/bin/elasticdump \
--input /Users/ryan/Desktop/data.json \
--output http://localhost:9200/companies \
--type data
zsh: no such file or directory: /usr/local/lib/node_modules/elasticdump/bin/elasticdump

Use "perl6" command with Git Bash on windows

Using Windows, I installed Rakudo Star and Git and ensured that C:\rakudo\bin and C:\rakudo\share\perl6\site\bin are in my Path environment variable.
Now, typing perl6 inside Git Bash afterwards gives the command not found error, while the command does work inside powershell and cmd. Typing echo $PATH inside Git Bash confirms again that the folders above are in my path variable here as well.
How can I get the perl6 command working inside Git Bash?
Note: Using moar (moar.exe) which resides in the same folder as perl6 works as well in Git Bash. Also hitting Tab show the autocomplete suggestion for moar, it does not do that for perl6.
Bash doesn't run Windows batch files, so you'll have to work around that.
An easy solution might be to add something like this you your .bashrc:
alias perl6='cmd /c perl6.bat'
Alternatively, you can convert perl6.bat to a shell script and put it somewhere in your $PATH.
I use the following:
#!/bin/sh
PATH=/cygdrive/c/rakudo/bin:/cygdrive/c/rakudo/share/perl6/site/bin:$PATH
unset HOME
moar --execname="$0" \
--libpath='C:\rakudo\share\nqp\lib' \
--libpath='C:\rakudo\share\perl6\lib' \
--libpath='C:\rakudo\share\perl6\runtime' \
'C:\rakudo\share\perl6\runtime\perl6.moarvm' \
"$#"
This is using Cygwin; you may need to adapt it a bit for Git bash (I don't know, no experience with it).
Alternatively, if you're using Windows 10, I can recommend installing WSL, and using perl6 in a WSL bash prompt instead. This runs much smoother for me than the Windows version under Cygwin.
I tried to install perl6 from the link you provided and I can confirm the same behavior on Cygwin on Windows 10.
If I type in the Cygwin terminal window:
$ perl6
-bash: perl6: command not found
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Users/Bruker/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/rakudo/bin:/cygdrive/c/rakudo/share/perl6/site/bin
$ cd /cygdrive/c/rakudo/bin
$ ls -l
-rwxrwx---+ 1 SYSTEM SYSTEM 930663 May 11 2017 libgcc_s_seh-1.dll
-rwxrwx---+ 1 SYSTEM SYSTEM 136146 Mar 30 20:55 libmoar.dll.a
-rwxrwx---+ 1 SYSTEM SYSTEM 56978 May 11 2017 libwinpthread-1.dll
-rwxrwx---+ 1 SYSTEM SYSTEM 7021172 Mar 30 20:55 moar.dll
-rwxrwx---+ 1 SYSTEM SYSTEM 64066 Mar 30 20:55 moar.exe
-rwxrwx---+ 1 SYSTEM SYSTEM 126 Mar 30 20:56 nqp.bat
-rwxrwx---+ 1 SYSTEM SYSTEM 126 Mar 30 20:56 nqp-m.bat
-rwxrwx---+ 1 SYSTEM SYSTEM 242 Mar 30 20:56 perl6.bat
-rwxrwx---+ 1 SYSTEM SYSTEM 248 Mar 30 20:56 perl6-debug-m.bat
-rwxrwx---+ 1 SYSTEM SYSTEM 242 Mar 30 20:56 perl6-m.bat
$ cat perl6.bat
# "C:\rakudo\bin\moar" --execname="%~dpf0" --libpath="C:\rakudo\share\nqp\lib" --libpath="C:\rakudo\share\nqp\lib" --libpath="C:\rakudo\share/perl6/lib" --libpath="C:\rakudo\share/perl6/runtime" C:\rakudo\share\perl6\runtime\perl6.moarvm %*
Notice that the paths in the bat file are not cygwin paths. So that might explain why it does not work..
For example:
$ "C:\rakudo\bin\moar"
-bash: C:\rakudo\bin\moar: command not found
$ /cygdrive/c/rakudo/bin/moar
ERROR: Missing input file.
USAGE: moar [--crash] [--libpath=...] input.moarvm [program args]
moar --dump input.moarvm
moar --help
[...]
Update:
I also tried install Git Bash, and then from the MINGW64 terminal window:
$ echo $PATH
/c/Users/Bruker/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Bruker/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Users/Bruker/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl
$ PATH=/c/rakudo/bin:$PATH
$ perl6
bash: perl6: command not found
$ moar
ERROR: Missing input file.
USAGE: moar [--crash] [--libpath=...] input.moarvm [program args]
moar --dump input.moarvm
moar --help
[...]
Note that moar is an .exe file while perl6 is a .bat file.
Also it seems perl6 is not "offical" for Cygwin yet according to this issue.

Why are my Snort logs empty?

I am running macOS Sierra 10.12.3
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.3
BuildVersion: 16D32
I have installed snort using homebrew
$ brew install snort
$ brew ls --versions snort
snort 2.9.9.0
I am running snort and with a user config file, -s syslog switch, and a tcpdump-file
$ sudo snort -c /etc/snort/snort.conf -s -r tcpdump.pcap
my /etc/snort/snort.conf file has the following output settings:
output alert_syslog: LOG_AUTH LOG_ALERT
When I execute,a blank file gets created at /var/log/snort/snort.log.1489953549
I know that my rules are working, because if I execute snort with an alert-mode of fast
$ sudo snort -c /etc/snort/snort.conf -A fast -r tcpdump.pcap
a new blank /var/log/snort/snort.log.1489954258 is created, but a /var/log/snort/alert log file is also created, which contains the correct alert outputs.
I have seen others run into this issue because of permissions, but I don't believe that is my problem given that I am running snort as sudo and it is able to write to the alert log just fine.
I also do not have $NO_PACKET_LOG as far as I can tell. reference
It looks like brew installed some default snort config files under /usr/local/etc/snort, but I don't think that these are affecting me because I am using the -c switch to supply a user config file.
DISCLAIMER: This is my first time using snort, so it could be something very obvious that I am missing. Any and all help is much appreciated.
TL;DR
Use tcpdump, snort, tshark, or Wireshark to read snort log files (how to view snort log files)
$ sudo tcpdump -r snort.log.1489953549
My empty log file was never actually empty (note file sizes from ls)
$ ls -ltr /var/log/snort/
-rw------- 1 root admin 56018718 Mar 19 15:03 snort.log.1489954258
-rw------- 1 root admin 56018718 Mar 19 15:11 snort.log.1489953549
-rw-r--r-- 1 root admin 70202224 Mar 19 15:11 alert
Snort log files must be read using the correct application
What type of file is it?
$ sudo file snort.log.1489953549
snort.log.1489953549: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 1514)
Read the file with tcpdump
$ sudo tcpdump -r snort.log.1489954258
06:54:16.654692 IP 192.168.5.81.amt-blc-port > 100.100.100.212.6667: Flags [P.], seq 1304973037:1304973067, ack 1425084530, win 8011, options [nop,nop,TS val 14215752 ecr 2196036272], length 30
...

Activestate install module

I just installed ActiveState to test the alternative to Cygwin/Perl and I get some problems to install a cpan package.
I would like to install Win32::GuiTest which is not listed under ppm. I then started a cmd.exe and typed:
C:\>cpan Win32::GuiTest
which returns:
c:\>cpan Win32::GuiTest
CPAN: Storable loaded ok (v2.45)
Reading '\cygdrive\e\home\.cpan\Metadata'
Database was generated on Mon, 22 Sep 2014 15:29:02 GMT
Running install for module 'Win32::GuiTest'
Running make for K/KA/KARASIK/Win32-GuiTest-1.60.tar.gz
CPAN: Digest::SHA loaded ok (v5.85)
CPAN: Compress::Zlib loaded ok (v2.063)
Checksum for \cygdrive\e\home\.cpan\sources\authors\id\K\KA\KARASIK\Win32-GuiTest-1.60.tar.gz ok
The system cannot find the path specified.
Uncompressed \cygdrive\e\home\.cpan\sources\authors\id\K\KA\KARASIK\Win32-GuiTest-1.60.tar.gz successfully
Using Tar:/usr/bin/tar xf "Win32-GuiTest-1.60.tar":
The system cannot find the path specified.
Couldn't untar Win32-GuiTest-1.60.tar: child exited with value 1
CPAN: File::Temp loaded ok (v0.2304)
CPAN: CPAN::Meta loaded ok (v2.132830)
CPAN: Time::HiRes loaded ok (v1.9726)
Package seems to come without Makefile.PL.
(The test -f "\cygdrive\e\home\.cpan\build\KARASIK-85id4t\Makefile.PL" returned false.)
Writing one on our own (setting NAME to Win32GuiTest)
Had problems unarchiving. Please build manually
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
So it seems cpan interacts somehow with cygwin and I don't know why. And I am running the correct version of cpan:
c:\>cpan --help
C:\Perl64\bin/cpan.bat version 1.61 calling Getopt::Std::getopts (version 1.07 [paranoid]),
running under Perl version 5.18.2.
Usage: cpan.bat [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]
The following single-character options are accepted:
With arguments: -j
Boolean (without arguments): -h -v -V -I -g -G -C -A -D -O -l -L -a -r -p -P -J -w -T -c -f -i -m -t -u
Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For more details run
perldoc -F C:\Perl64\bin/cpan.bat
[Now continuing due to backward compatibility and excessive paranoia.
See 'perldoc Getopt::Std' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!
Does someone knows what I did wrong?

Implementing shutdown command from scratch

root ~$ shutdown
-sh: shutdown: not found
root ~$ shutdown -h now
-sh: shutdown: not found
None of the commands are working . I think I need to link the command from scratch. Can anybody guide?
uname -a
gives
2.6.35.3 #49 PREEMPT Wed Jun 11 20:03:43 IST 2014 armv5tejl GNU/Linux
Try to call the command with complete path: /sbin/shutdown
moreover on most systems it is a root only command, so you should call it from root user (I am seeing the $ at the end of command prompt, so I am guessing you are not root)
Other commands you can try are presented here;
or you can use the init 0 command always as root user.
Writing the shutdown code is a last costly resort only if all the other alternatives fail.

Resources