Re: Correct shebang for Python 3

2016-10-22 Thread Eugene Yunak
On 23 October 2016 at 03:01, john slee  wrote:
> Meta: this "how do I manage multiple Pythons?" thing has come up a couple
> of times lately; are people interested in a FAQ section?
>
> On 23 October 2016 at 03:54, Eugene Yunak  wrote:
>> I'd set the shebang to `/usr/bin/env python3`, or `/usr/bin/env python` if
>> you
>> do not care whether 2 or 3 would be used.
>
> Use `virtualenv'
> if you need to use a mix of Python versions, and always use the latter
> shebang
> form.
>
> Hope this helps.

I fail to see how's virtualenv relevant to this question. Clearly, Ovidiu is the
*developer*, and he explores his options as a developer. It's up to the user (or
his sysadmin) to have the correct base python or a virtualenv set up - you say
so yourself.

-- 
The best the little guy can do is what
the little guy does right



Re: OpenBSD Only BSD Install Image Booting on MS Surface Pro 3

2016-10-22 Thread Fred

On 10/23/16 01:23, David Clark wrote:

Just thought you might like to know that OpenBSD is currently the only BSD
whose Live CD or USB Image I have been able to boot on my Microsoft Surface
Pro 3.  Not NetBSD, FreeBSD, or DragonFlyBSD.

Not ready to install yet, but if I do, I'll send you stats post
installation.

David


I've been running OpenBSD on a Surface Pro 3 for a while, see dmesg below.

The Marvel wireless currently does not work so using a usb ethernet 
adapter for networking.


Cheers

Fred

dmesg:

OpenBSD 6.0-current (GENERIC.MP) #2559: Tue Oct 11 18:42:09 MDT 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 
3f

real mem = 4179070976 (3985MB)
avail mem = 4047880192 (3860MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xabc09000 (19 entries)
bios0: vendor American Megatrends Inc. version "3.11.0760" date 03/16/2015
bios0: Microsoft Corporation Surface Pro 3
acpi0 at bios0: rev 2
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP APIC FPDT SSDT HPET MSDM WDSA LPIT DBGP HPET 
MCFG SSDT SSDT SSDT SSDT UEFI DMAR BGRT
acpi0: wakeup devices WIFI(S4) LID0(S3) EC0_(S3) XHC_(S4) HDEF(S4) 
PEG0(S4) PEGP(S4) PEG1(S4) PEG2(S4)

acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz, 1796.17 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT

cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz, 1795.85 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT

cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz, 1795.85 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT

cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 1, core 0, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz, 1795.85 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT

cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 8 pa 0xfec0, version 20, 40 pins
acpihpet0 at acpi0: 14318179 Hz
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (BR03)
acpiprt2 at acpi0: bus -1 (BR04)
acpiprt3 at acpi0: bus -1 (BR05)
acpiprt4 at acpi0: bus -1 (BR0B)
acpiprt5 at acpi0: bus 1 (RP01)
acpiprt6 at acpi0: bus -1 (PEG0)
acpiprt7 at acpi0: bus -1 (PEG1)
acpiprt8 at acpi0: bus -1 (PEG2)
acpiec0 at acpi0
acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), 
C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), 
C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), 
C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), 
C1(1000@1 mwait.1), PSS

acpipwrres0 at acpi0: CAMP, resource for HS07, HS08
acpipwrres1 at acpi0: TPWR, resource for TCH1
acpipwrres2 at acpi0: PAUD, resource for HDEF
acpipwrres3 at acpi0: PRWF, resource for WIFI
acpitz0 at acpi0acpitz0: TZ0_: failed to read _CRT
acpitz0: TZ0_: failed to read _HOT
acpitz0: TZ0_: failed to read _TMP
acpitz0: TZ0_: failed to read _TMP
acpibtn0 at acpi0: LID0
"MSHW0029" at acpi0 not configured
"MSHW0028" at 

OpenBSD Only BSD Install Image Booting on MS Surface Pro 3

2016-10-22 Thread David Clark
Just thought you might like to know that OpenBSD is currently the only BSD
whose Live CD or USB Image I have been able to boot on my Microsoft Surface
Pro 3.  Not NetBSD, FreeBSD, or DragonFlyBSD.

Not ready to install yet, but if I do, I'll send you stats post
installation.

David



Re: Correct shebang for Python 3

2016-10-22 Thread john slee
Meta: this "how do I manage multiple Pythons?" thing has come up a couple
of times lately; are people interested in a FAQ section?

On 23 October 2016 at 03:54, Eugene Yunak  wrote:
> I'd set the shebang to `/usr/bin/env python3`, or `/usr/bin/env python`
if you
> do not care whether 2 or 3 would be used.

Use `virtualenv' (you may need to install it separately; `pip install
virtualenv')
if you need to use a mix of Python versions, and always use the latter
shebang
form.

So, an example. Say you found two Python apps that you want to use.
Let's call them "oldapp" and "newapp". oldapp needs python 2.7 and
newapp is OK with python 3+. Both include 'requirements.txt' files to
indicate what their Python package dependencies are.

If it's a popular app you may be able to install the app this way as well,
with the `pip' utility, thus keeping it all nicely contained within the
virtualenv. But I'll assume that that's not possible here.

The apps are installed in $HOME/apps/oldapp and $HOME/apps/newapp

1. After installing both Pythons, make a place to keep your virtualenvs

mkdir $HOME/py

2. Create the virtualenvs and install dependencies

virtualenv -p /usr/local/bin/python2.7 $HOME/py/oldapp
. $HOME/py/newapp/bin/activate
python --version ### to demonstrate that virtualenv works
pip install -r $HOME/apps/oldapp/requirements.txt

virtualenv -p /usr/local/bin/python3 $HOME/py/newapp
. $HOME/py/newapp/bin/activate
python --version ### to demonstrate that virtualenv works
pip install -r $HOME/apps/newapp/etc/requirements.txt

3. Observe that all of these dependencies are installed inside the
relevant virtualenv. So they will never conflict with each other or
pollute your /usr/local tree.

4. To actually run an app

. $HOME/py/newapp/bin/activate
$HOME/apps/newapp/bin/newapp.py

. $HOME/py/oldapp/bin/activate
$HOME/apps/oldapp/bin/oldapp.py

Hope this helps.

John



Re: Full disk encryption by auto install

2016-10-22 Thread Tito Mari Francis H . Escaño
I'm sorry but I already reached the 2014 thread of the misc archives and have
not found any discussion of this. Not sure we have the same definition of
"recently" in this case :)
Maybe Dekker or somebody can share the thread subject and I'll go from there.
Otherwise, I'm open to further advise on this matter.
Thanks again.

-Original Message-
From: "Dekker" 
Sent: ‎10/‎18/‎2016 11:18 AM
To: "Tito Mari Francis Escaño" 
Cc: "misc@openbsd.org" 
Subject: Re: Full disk encryption by auto install

This has been discussed previously... And recently.
Search the mailing lists and you will find your answers.


On Oct 17, 2016, at 23:12, "Tito Mari Francis Escaño"
 wrote:
Hello everyone,Is full disk encryption via auto install script feasible? Has
anyonetried this before? Maybe somebody can share pointers on what to watchout
for if it's already been done.I was wondering how the full disk encryption
password can be securedduring auto install. Maybe somebody can share their
practices on this.Thanks so much.



Ripping CDs and DVDs

2016-10-22 Thread Vijay Sankar
Hi,

In preparation for my retirement in 2050, I am setting up a media server
for all my DVDs and CDs.

For ripping CD's, I was planning to use abcde as follows:

abcde -q high -o mp3

For DVD's, I was thinking of stuff (thanks to Christian "naddy" Weisberger)
like

mplayer -dumpstream -dumpfile i-robot.vob dvd://1

The plan is to upload these files to an OpenBSD 5.9 server running minidlna
and then watch some of these (once the thousands of CDs and DVDs are
ripped) some day using VLC media player on an iPhone/iPad or my OpenBSD
desktop.

Am I on the right track or is there a better way to do this? Any advice
gratefully appreciated and accepted.

Thank you very much,

Vijay
-- 
Vijay Sankar, M.Eng., P.Eng.
ForeTell Technologies Limited
vsan...@foretell.ca



Re: security(8) doesn't know about mailbox locks

2016-10-22 Thread Ingo Schwarze
Hi,

Philippe Meunier wrote on Fri, Oct 21, 2016 at 12:35:46PM -0400:

> When cron runs /etc/daily, that script runs df and netstat and the
> output is sent by email to root.  On my system, emails to root are
> forwarded to local user meunier using /root/.forward.  The forwarding
> itself temporarily creates a lock file in /var/mail:
> 
> -rw---  1 root wheel 0 Oct 21 23:55 meunier.lock
> 
> At the same time, /etc/daily runs /usr/libexec/security.  The
> check_mailboxes function in that file loops over all the files in
> /var/mail and checks whether the owner of the file matches the name of
> the file.  If check_mailboxes happens to be running exactly at the
> same time as the system is forwarding /etc/daily's first email, then
> check_mailboxes sees meunier.lock, the check for that file fails, and
> the result is another email sent to root:
> 
> Running security(8):
> 
> Checking mailbox ownership.
> user meunier.lock mailbox is owned by root
> 
> So I think the check_mailboxes function in /usr/libexec/security
> should either skip lock files or check them in a different way...

I just fixed this by committing the following patch.

Thanks for reporting,
  Ingo


CVSROOT:/cvs
Module name:src
Changes by: schwa...@cvs.openbsd.org2016/10/22 12:35:12

Modified files:
libexec/security: security 

Log message:
When checking ownership and modes of files in /var/mail/,
ignore *.lock files, to avoid pointless warning mails
reported by Philippe Meunier ;
OK florian@ jca@


Index: security
===
RCS file: /cvs/src/libexec/security/security,v
retrieving revision 1.36
diff -u -p -r1.36 security
--- security21 Jul 2015 19:07:13 -  1.36
+++ security22 Oct 2016 06:25:15 -
@@ -455,6 +455,7 @@ sub check_mailboxes {
nag !(opendir my $dh, $dir), "opendir: $dir: $!" and return;
foreach my $name (readdir $dh) {
next if $name =~ /^\.\.?$/;
+   next if $name =~ /.\.lock$/;
my ($mode, $fuid, $fgid) = (stat "$dir/$name")[2,4,5];
unless (defined $mode) {
nag !$!{ENOENT}, "stat: $dir/$name: $!";



Re: How to analyse excessive PF states?

2016-10-22 Thread Peter N. M. Hansteen
On 10/22/16 18:12, Federico Giannici wrote:
> We have a firewall with OpenBSD 6.0 amd64 that handles about 1.5 Gbps of
> traffic.
> 
> I noticed that from a few weeks the number of states is increased from
> around 250.000 to almost 2 millions (no change in PF config)!
> 
> At the same time the firewall started loosing a few packets (around
> 1-2%, with peeks of 4%). Maybe this is due to too many states to handle?
> 
> How can we find what's happening and creates all these states?
> How can we analyse almost 2 millions states to find the culprit?

The exact answers depend a great deal on what monitoring you have in
place already. At the very least studying the output of pfctl -ss
(massaged via some scriptery if needed) will give some clues. Better if
you have something that keeps track of connections and states over time
(netflow export via pflow comes to mind).

The packet loss could conceivable by a side effect of the number of
states going into the territory where timeouts are scaled down
(exceeding 60% of state table limit IIRC).

- P

-- 
Peter N. M. Hansteen, member of the first RFC 1149 implementation team
http://bsdly.blogspot.com/ http://www.bsdly.net/ http://www.nuug.no/
"Remember to set the evil bit on all malicious network traffic"
delilah spamd[29949]: 85.152.224.147: disconnected after 42673 seconds.



Re: Correct shebang for Python 3

2016-10-22 Thread Eugene Yunak
On 22 October 2016 at 18:04, Ovidiu M  wrote:
> Hi everyone,
>
> I wrote a script which may end up as part of a package on various
> Linux and BSD flavors, and I have hit the problem of getting the
> shebang working everywhere. You might know that Python is installed in
> different locations, with the binary having different names (for
> example python sometimes points to python2.x, sometimes to python3.x
> etc.).
>
> Currently my code is compatible with both Python 2 and 3, but to keep
> things simple I'd rather use only one of them, probably 3.
>
> What is the correct way to write a shebang on OpenBSD? I thought that
> the following would work on most Unixes:
>
> #!/usr/bin/env python3
>
> or even this, with the risk of not knowing if it points to 2 or 3:
>
> #!/usr/bin/env python
>
> Unfortunately when I install the python3 package with pkg_add
> (actually 3.5) on OpenBSD, no symlink is created from python3 to 3.5,
> so this fails. I do not want to add a hard dependency on specifically
> 3.5 in the shebang of my script, since it may become obsolete in a
> couple of years, and it may be incompatible with other OSes which
> might not have 3.5, but maybe 3.4 or 3.6.
>
> Should I instead use an installation-time script that generates the
> right shebang?
>
> How about a wrapper shell script which searches for a python
> executable and then calls it with a path to the script? For example
> the following polyglot script would work:
>
>   #!/bin/sh
>   which python3 >/dev/null 2>&1 && exec python3 "$0" "$@" # '''
>   which python3.6 >/dev/null 2>&1 && exec python3.6 "$0" "$@" # '''
>   which python3.5 >/dev/null 2>&1 && exec python3.5 "$0" "$@" # '''
>   which python3.4 >/dev/null 2>&1 && exec python3.4 "$0" "$@" # '''
>   exec echo "fatal: cannot find python3 binary" # '''
>
> All these methods seem quite convoluted for doing something so simple.
> Please let me know what you think.
>
> Thanks in advance for your advice.
> Ovidiu
>

Hi Ovidiu,

Personally I expect the system administrator to configure the necessary
symlinks, it's something I always do on my systems. Most python software relies
on these to exist, and the OpenBSD package readme recommends their creation for
new users.

I'd set the shebang to `/usr/bin/env python3`, or `/usr/bin/env python` if you
do not care whether 2 or 3 would be used.

Cheers,
Eugene

-- 
The best the little guy can do is what
the little guy does right



How to analyse excessive PF states?

2016-10-22 Thread Federico Giannici
We have a firewall with OpenBSD 6.0 amd64 that handles about 1.5 Gbps of 
traffic.


I noticed that from a few weeks the number of states is increased from 
around 250.000 to almost 2 millions (no change in PF config)!


At the same time the firewall started loosing a few packets (around 
1-2%, with peeks of 4%). Maybe this is due to too many states to handle?


How can we find what's happening and creates all these states?
How can we analyse almost 2 millions states to find the culprit?

Here it is the current output of "pfctl -s info":
Status: Enabled for 13 days 23:14:21 Debug: err

State Table  Total Rate
  current entries  1706364
  searches354572035074   293796.9/s
  inserts  1397321002311578.1/s
  removals 1397150365911576.7/s
Counters
  match1421898589311781.8/s
  bad-offset 00.0/s
  fragment   600570.0/s
  short  648250.1/s
  normalize 5744690.5/s
  memory 00.0/s
  bad-timestamp  00.0/s
  congestion   47116053.9/s
  ip-option5340.0/s
  proto-cksum00.0/s
  state-mismatch   4550.0/s
  state-insert65980.0/s
  state-limit00.0/s
  src-limit  00.0/s
  synproxy   00.0/s
  translate  00.0/s
  no-route   00.0/s


Thank you for any suggestion.



Re: 2 files, same name, same dir

2016-10-22 Thread Kamil Cholewiński
On Sat, 22 Oct 2016, Nick Holland  wrote:
> (and it wouldn't surprise me if Linux "saves" you from this error, and
> it would just make me hate it all the more)

No need to kick the poor penguin...

> $ uname
> Linux
> $ mkdir /tmp/test
> $ cd $_
> $ touch "pi.c"
> $ touch "pi.c "
> $ ls | hexdump -C
>   70 69 2e 63 0a 70 69 2e  63 20 0a |pi.c.pi.c .|
> 000b



Re: 2 files, same name, same dir

2016-10-22 Thread Alan Corey
I can probably blame it on the Joe editor, which leaves trailing
spaces on lines in files too.  I wrote a program once to strip them
off, probably doesn't bother anybody else.  When you save a file it
prompts with a (previous) filename with the cursor at the end, bumping
the spacebar then would do it, I've hit other characters by accident
and had those end up in filenames.  I've been using Joe for ~20 years.

But a trailing space on a filename, after the extension, is pointless
to keep.  Probably featureitis to build in looking for them though.

On 10/22/16, Alan Corey  wrote:
> Bingo, a trailing space.  I would have thought that would get trimmed
> off somehow.  I don't normally put spaces in filenames, I must have
> fat-fingered something.  But I see no reason to keep trailing spaces.
>
> -rw-r--r--  1 alan  wheel25549 Oct 22 10:55 pi.c\$
> -rw-r--r--  1 root  wheel25152 Oct 22 00:07 pi.c \$



Re: 2 files, same name, same dir

2016-10-22 Thread Nick Holland
On 10/22/16 11:26, Alan Corey wrote:
> Bingo, a trailing space.  I would have thought that would get trimmed
> off somehow.  I don't normally put spaces in filenames, I must have
> fat-fingered something.  But I see no reason to keep trailing spaces.

um. Unix.

File names can have almost any character, and they are all equally valid
in all places in the file name.  This ain't CP/M or its derivatives
(like Windows).

(and it wouldn't surprise me if Linux "saves" you from this error, and
it would just make me hate it all the more)

Nick.



> 
> -rw-r--r--  1 alan  wheel25549 Oct 22 10:55 pi.c\$
> -rw-r--r--  1 root  wheel25152 Oct 22 00:07 pi.c \$
> 
>> Likely one of them has  space or so in it's name. Use
>>
>> $ ls -l | vis -l
>>
>> or some variation.
>>
>>  -Otto



Re: 2 files, same name, same dir

2016-10-22 Thread Alan Corey
Bingo, a trailing space.  I would have thought that would get trimmed
off somehow.  I don't normally put spaces in filenames, I must have
fat-fingered something.  But I see no reason to keep trailing spaces.

-rw-r--r--  1 alan  wheel25549 Oct 22 10:55 pi.c\$
-rw-r--r--  1 root  wheel25152 Oct 22 00:07 pi.c \$

> Likely one of them has  space or so in it's name. Use
>
> $ ls -l | vis -l
>
> or some variation.
>
>   -Otto
>


-- 
Credit is the root of all evil.  - AB1JX



Re: 2 files, same name, same dir

2016-10-22 Thread Otto Moerbeek
On Sat, Oct 22, 2016 at 11:08:47AM -0400, Alan Corey wrote:

> This is in 5.7 but I don't understand how it could happen (and I never
> noticed it before).  Two files in the same directory with the same
> name, different owners.  Last night I was noticing that my edits to my
> program sometimes weren't taking effect, this seems to be why.  Ideas?
>  I can delete the wrong one from mc probably, I just wanted to mention
> it.
> 
> -rw-r--r--1 alan  wheel25549 Oct 22 10:55 pi.c
> -rw-r--r--1 root  wheel25152 Oct 22 00:07 pi.c
> freebie# whoami
> root
> 
> 
> -- 
> Credit is the root of all evil.  - AB1JX

Likely one of them has  space or so in it's name. Use  

$ ls -l | vis -l

or some variation.

-Otto



Re: 2 files, same name, same dir

2016-10-22 Thread Jeremie Courreges-Anglas
Alan Corey  writes:

> This is in 5.7

Boo.

> but I don't understand how it could happen (and I never
> noticed it before).  Two files in the same directory with the same
> name, different owners.  Last night I was noticing that my edits to my
> program sometimes weren't taking effect, this seems to be why.  Ideas?
>  I can delete the wrong one from mc probably, I just wanted to mention
> it.
>
> -rw-r--r--1 alan  wheel25549 Oct 22 10:55 pi.c
> -rw-r--r--1 root  wheel25152 Oct 22 00:07 pi.c
> freebie# whoami
> root

Are you sure that the names are exactly the same?  env LC_ALL=C ls,
hexdump, etc

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



2 files, same name, same dir

2016-10-22 Thread Alan Corey
This is in 5.7 but I don't understand how it could happen (and I never
noticed it before).  Two files in the same directory with the same
name, different owners.  Last night I was noticing that my edits to my
program sometimes weren't taking effect, this seems to be why.  Ideas?
 I can delete the wrong one from mc probably, I just wanted to mention
it.

-rw-r--r--1 alan  wheel25549 Oct 22 10:55 pi.c
-rw-r--r--1 root  wheel25152 Oct 22 00:07 pi.c
freebie# whoami
root


-- 
Credit is the root of all evil.  - AB1JX



Correct shebang for Python 3

2016-10-22 Thread Ovidiu M
Hi everyone,

I wrote a script which may end up as part of a package on various
Linux and BSD flavors, and I have hit the problem of getting the
shebang working everywhere. You might know that Python is installed in
different locations, with the binary having different names (for
example python sometimes points to python2.x, sometimes to python3.x
etc.).

Currently my code is compatible with both Python 2 and 3, but to keep
things simple I'd rather use only one of them, probably 3.

What is the correct way to write a shebang on OpenBSD? I thought that
the following would work on most Unixes:

#!/usr/bin/env python3

or even this, with the risk of not knowing if it points to 2 or 3:

#!/usr/bin/env python

Unfortunately when I install the python3 package with pkg_add
(actually 3.5) on OpenBSD, no symlink is created from python3 to 3.5,
so this fails. I do not want to add a hard dependency on specifically
3.5 in the shebang of my script, since it may become obsolete in a
couple of years, and it may be incompatible with other OSes which
might not have 3.5, but maybe 3.4 or 3.6.

Should I instead use an installation-time script that generates the
right shebang?

How about a wrapper shell script which searches for a python
executable and then calls it with a path to the script? For example
the following polyglot script would work:

  #!/bin/sh
  which python3 >/dev/null 2>&1 && exec python3 "$0" "$@" # '''
  which python3.6 >/dev/null 2>&1 && exec python3.6 "$0" "$@" # '''
  which python3.5 >/dev/null 2>&1 && exec python3.5 "$0" "$@" # '''
  which python3.4 >/dev/null 2>&1 && exec python3.4 "$0" "$@" # '''
  exec echo "fatal: cannot find python3 binary" # '''

All these methods seem quite convoluted for doing something so simple.
Please let me know what you think.

Thanks in advance for your advice.
Ovidiu



Re: ntpd terminates after a few seconds of running

2016-10-22 Thread Andreas Kusalananda Kähäri
On Thu, Oct 20, 2016 at 03:46:42PM +0200, Andreas Kusalananda Kähäri wrote:
> On Thu, Oct 20, 2016 at 02:44:56PM +0200, Rafael Zalamena wrote:
> > On Thu, Oct 20, 2016 at 02:18:27PM +0200, Andreas Kusalananda K?h?ri
wrote:
> > > Hi,
> > >
> > > Running -current on amd64, I noticed that the ntpd daemon wasn't
> > > responding:
> > >
> > > $ ntpctl -s all
> > > ntpctl: connect: /var/run/ntpd.sock: Connection refused
> > >
> > > So I restarted it and tried again:
> > >
> > > ---snip---
> >
> > Hello,
> >
> > How old is the snapshot you are using?
> >
> > I just made 2 commits to fix ntpd(8) closings yesterday, so if you get
> > one snapshot from today and on or get the newer ntpd sources you can
> > try to reproduce this again.
> >
> > For more information you can look at the thread
> > "ntpd failing during runtime without indication why" in the
> b...@openbsd.org
> > mailing list.
> >
>
> I'm using sources from the 15th (last Saturday).  I will rebuild when
> I get time to do so (probably during the weekend). Thanks for the
> response!  I'll get back to you if this is still an issue later.
>

Just to say that this issue went away after a rebuild of my system with
newer sources.  Thanks!


Andreas


--
Andreas Kusalananda Kähäri
Bioinformatics Developer
NBIS, Uppsala University
http://www.nbis.se/

[demime 1.01d removed an attachment of type application/pgp-signature which had 
a name of signature.asc]



Re: OpenBSD 6-stable vmd

2016-10-22 Thread R0me0 ***
Hey Peter ,

Thank you for the advice, I'll get current

Cheers dude !

(:


2016-10-22 6:44 GMT-02:00 Peter Hessler :

> This isn't expected to work at all.  That is why it was disabled.
> You'll need to upgrade the Hypervisor to -current, or to 6.1 when it is
> released.
>
>
>
> On 2016 Oct 22 (Sat) at 00:06:08 -0200 (-0200), R0me0 *** wrote:
> :Hello misc.
> :
> :For testing purposes
> :
> :I compiled kernel with vmd support.
> :
> :After start the vm -> vmctl start "myvm" -m 512M -i 1 -d disk.img -k
> /bsd.rd
> :
> :I created a bridge and added vether0 and tap0
> :
> :In the vm I have configured an ip 192.168.1.30
> :
> :If I perform ping from OpenBSD Hypervisor -> ping 192.168.1.30 all
> packages
> :are send and received "on the fly"
> :
> :But if I perform the same step from "myvm", there is no packet loss but
> the
> :packets take so long to be send and consecutively replied
> :
> :I am performing this tests on Linux  running Vmware Workstation 12 .
> :
> :Is this behavior expected ?
> :
> :Any directions will be appreciated.
> :
> :Thank you
> :
> :myvm dmesg:
> :
> :OpenBSD 6.0 (RAMDISK_CD) #2100: Tue Jul 26 13:05:59 MDT 2016
> :   dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
> :RTC BIOS diagnostic error 20
> :real mem = 520093696 (496MB)
> :avail mem = 502673408 (479MB)
> :mainbus0 at root
> :bios0 at mainbus0
> :acpi at bios0 not configured
> :cpu0 at mainbus0: (uniprocessor)
> :cpu0: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 14335.74 MHz
> :cpu0:
> :FPU,VME,DE,PSE,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,
> SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,AVX,F1
> :6C,RDRAND,HV,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,ARAT
> :pvbus0 at mainbus0: OpenBSD
> :pci0 at mainbus0 bus 0
> :pchb0 at pci0 dev 0 function 0 "OpenBSD VMM PCI Host Bridge" rev 0x00
> :virtio0 at pci0 dev 1 function 0 "Qumranet Virtio RNG" rev 0x00
> :viornd0 at virtio0
> :virtio0: irq 3
> :virtio1 at pci0 dev 2 function 0 "Qumranet Virtio Storage" rev 0x00
> :vioblk0 at virtio1
> :scsibus0 at vioblk0: 2 targets
> :sd0 at scsibus0 targ 0 lun 0:  SCSI3 0/direct
> fixed
> :sd0: 5120MB, 512 bytes/sector, 10485760 sectors
> :virtio1: irq 5
> :virtio2 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00
> :vio0 at virtio2: address fe:e1:ba:d0:d0:94
> :virtio2: irq 9
> :isa0 at mainbus0
> :com0 at isa0 port 0x3f8/8 irq 4: ns8250, no fifo
> :com0: console
> :softraid0 at root
> :scsibus1 at softraid0: 256 targets
> :root on rd0a swap on rd0b dump on rd0b
> :WARNING: invalid time in clock chip
> :WARNING: CHECK AND RESET THE DATE!
> :
> :openbsd hypervisor :
> :
> :
> :OpenBSD 6.0-stable (GENERIC.MP) #0: Fri Oct 21 20:07:42 BRST 2016
> :   root@puffysor.localdomain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> :real mem = 2130640896 (2031MB)
> :avail mem = 2061631488 (1966MB)
> :mpath0 at root
> :scsibus0 at mpath0: 256 targets
> :mainbus0 at root
> :bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe0010 (242 entries)
> :bios0: vendor Phoenix Technologies LTD version "6.00" date 07/02/2015
> :bios0: VMware, Inc. VMware Virtual Platform
> :acpi0 at bios0: rev 2
> :acpi0: sleep states S0 S1 S4 S5
> :acpi0: tables DSDT FACP BOOT APIC MCFG SRAT HPET WAET
> :acpi0: wakeup devices PCI0(S3) USB_(S1) P2P0(S3) S1F0(S3) S2F0(S3)
> S3F0(S3)
> :S4F0(S3) S5F0(S3) S6F0(S3) S7F0(S3) S8F0(S3) S9F0(S3) S10F(S3) S11F(S3)
> :S12F(S3) S13F(S3) [...]
> :acpitimer0 at acpi0: 3579545 Hz, 24 bits
> :acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> :cpu0 at mainbus0: apid 0 (boot processor)
> :cpu0: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 3800.69 MHz
> :cpu0:
> :FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,
> PCLMUL,VMX,SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLIN
> :E,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,
> PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
> :
> :cpu0: 256KB 64b/line 8-way L2 cache
> :cpu0: smt 0, core 0, package 0
> :mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> :cpu0: apic clock running at 65MHz
> :cpu1 at mainbus0: apid 1 (application processor)
> :cpu1: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 3810.50 MHz
> :cpu1:
> :FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,
> PCLMUL,VMX,SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLIN
> :E,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,
> PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
> :
> :cpu1: 256KB 64b/line 8-way L2 cache
> :cpu1: smt 0, core 1, package 0
> :ioapic0 at mainbus0: apid 2 pa 0xfec0, version 11, 24 pins
> :acpimcfg0 at acpi0 addr 0xf000, bus 0-127
> :acpihpet0 at acpi0: 14318179 Hz
> :acpiprt0 at acpi0: bus 0 (PCI0)
> :acpicpu0 at acpi0: C1(@1 halt!)
> :acpicpu1 at acpi0: C1(@1 

Re: OpenBSD 6-stable vmd

2016-10-22 Thread Peter Hessler
This isn't expected to work at all.  That is why it was disabled.
You'll need to upgrade the Hypervisor to -current, or to 6.1 when it is
released.



On 2016 Oct 22 (Sat) at 00:06:08 -0200 (-0200), R0me0 *** wrote:
:Hello misc.
:
:For testing purposes
:
:I compiled kernel with vmd support.
:
:After start the vm -> vmctl start "myvm" -m 512M -i 1 -d disk.img -k /bsd.rd
:
:I created a bridge and added vether0 and tap0
:
:In the vm I have configured an ip 192.168.1.30
:
:If I perform ping from OpenBSD Hypervisor -> ping 192.168.1.30 all packages
:are send and received "on the fly"
:
:But if I perform the same step from "myvm", there is no packet loss but the
:packets take so long to be send and consecutively replied
:
:I am performing this tests on Linux  running Vmware Workstation 12 .
:
:Is this behavior expected ?
:
:Any directions will be appreciated.
:
:Thank you
:
:myvm dmesg:
:
:OpenBSD 6.0 (RAMDISK_CD) #2100: Tue Jul 26 13:05:59 MDT 2016
:   dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
:RTC BIOS diagnostic error 20
:real mem = 520093696 (496MB)
:avail mem = 502673408 (479MB)
:mainbus0 at root
:bios0 at mainbus0
:acpi at bios0 not configured
:cpu0 at mainbus0: (uniprocessor)
:cpu0: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 14335.74 MHz
:cpu0:
:FPU,VME,DE,PSE,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,SSE3,PCLMUL,SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,AVX,F1
:6C,RDRAND,HV,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,ARAT
:pvbus0 at mainbus0: OpenBSD
:pci0 at mainbus0 bus 0
:pchb0 at pci0 dev 0 function 0 "OpenBSD VMM PCI Host Bridge" rev 0x00
:virtio0 at pci0 dev 1 function 0 "Qumranet Virtio RNG" rev 0x00
:viornd0 at virtio0
:virtio0: irq 3
:virtio1 at pci0 dev 2 function 0 "Qumranet Virtio Storage" rev 0x00
:vioblk0 at virtio1
:scsibus0 at vioblk0: 2 targets
:sd0 at scsibus0 targ 0 lun 0:  SCSI3 0/direct fixed
:sd0: 5120MB, 512 bytes/sector, 10485760 sectors
:virtio1: irq 5
:virtio2 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00
:vio0 at virtio2: address fe:e1:ba:d0:d0:94
:virtio2: irq 9
:isa0 at mainbus0
:com0 at isa0 port 0x3f8/8 irq 4: ns8250, no fifo
:com0: console
:softraid0 at root
:scsibus1 at softraid0: 256 targets
:root on rd0a swap on rd0b dump on rd0b
:WARNING: invalid time in clock chip
:WARNING: CHECK AND RESET THE DATE!
:
:openbsd hypervisor :
:
:
:OpenBSD 6.0-stable (GENERIC.MP) #0: Fri Oct 21 20:07:42 BRST 2016
:   root@puffysor.localdomain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
:real mem = 2130640896 (2031MB)
:avail mem = 2061631488 (1966MB)
:mpath0 at root
:scsibus0 at mpath0: 256 targets
:mainbus0 at root
:bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe0010 (242 entries)
:bios0: vendor Phoenix Technologies LTD version "6.00" date 07/02/2015
:bios0: VMware, Inc. VMware Virtual Platform
:acpi0 at bios0: rev 2
:acpi0: sleep states S0 S1 S4 S5
:acpi0: tables DSDT FACP BOOT APIC MCFG SRAT HPET WAET
:acpi0: wakeup devices PCI0(S3) USB_(S1) P2P0(S3) S1F0(S3) S2F0(S3) S3F0(S3)
:S4F0(S3) S5F0(S3) S6F0(S3) S7F0(S3) S8F0(S3) S9F0(S3) S10F(S3) S11F(S3)
:S12F(S3) S13F(S3) [...]
:acpitimer0 at acpi0: 3579545 Hz, 24 bits
:acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
:cpu0 at mainbus0: apid 0 (boot processor)
:cpu0: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 3800.69 MHz
:cpu0:
:FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,VMX,SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLIN
:E,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
:
:cpu0: 256KB 64b/line 8-way L2 cache
:cpu0: smt 0, core 0, package 0
:mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
:cpu0: apic clock running at 65MHz
:cpu1 at mainbus0: apid 1 (application processor)
:cpu1: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz, 3810.50 MHz
:cpu1:
:FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,MMX,FXSR,SSE,SSE2,SS,HTT,SSE3,PCLMUL,VMX,SSSE3,FMA3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLIN
:E,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
:
:cpu1: 256KB 64b/line 8-way L2 cache
:cpu1: smt 0, core 1, package 0
:ioapic0 at mainbus0: apid 2 pa 0xfec0, version 11, 24 pins
:acpimcfg0 at acpi0 addr 0xf000, bus 0-127
:acpihpet0 at acpi0: 14318179 Hz
:acpiprt0 at acpi0: bus 0 (PCI0)
:acpicpu0 at acpi0: C1(@1 halt!)
:acpicpu1 at acpi0: C1(@1 halt!)
:"PNP0001" at acpi0 not configured
:"PNP0303" at acpi0 not configured
:"VMW0003" at acpi0 not configured
:"PNP0A05" at acpi0 not configured
:acpiac0 at acpi0: AC unit online
:pvbus0 at mainbus0: VMware
:vmt0 at pvbus0
:pci0 at mainbus0 bus 0
:pchb0 at pci0 dev 0 function 0 "Intel 82443BX AGP" rev 0x01
:ppb0 at pci0 dev 1 function 0 "Intel 82443BX AGP" rev 0x01
:pci1 at ppb0 bus 1
:pcib0 at pci0 

Re: log monitoring recommendations?

2016-10-22 Thread Timo Myyrä
Patrick Dohman  writes:

> Any opinions/ideas regarding log monitoring. 
> Preferably something with definable actions.
> Hoping to test/obtain a fail2ban equivalent for BSD
>
> The following utilities were located in openports.se
> hatchet
> logsentry
> logsurfer
> swatch
>
> Regards
> Patrick
>

Check out SEC which is also in the ports.
http://simple-evcorr.sourceforge.net/SEC-tutorial/article.html

Timo