Re: xenodm: save ~/.xesssion to ~/.xsession.old

2022-11-14 Thread Aaron Bieber


Klemens Nanni  writes:

> X segfaulted when I opened a window, Xorg.log.old only showed the
> address without anything specific, no core dump was created and
> xenodm automatically restarted.
>
> After I logged in I checked ~/.xsession for possible indications, but
> that file gets truncated on login.
>
> I've restarted xenodm again, so the old Xorg.log.old containing the
> generic "X segfaulted at addr 0x86..." is also gone.
>
> Woul it make sense to save an old copy in analogy to Xorg.log.old
> so crashes like this have a higher chance of being hunted down?
>
> I haven't extensively tested this patch, but relogging into X now leaves
> ~/.xesssion-errors.old with logs from the previous session behind.
>

Tested, works as expected! This would have helped me semi-recently!

OK abieber@ fwiw :D

> Index: app/xenodm//config/Xsession.in
> ===
> RCS file: /cvs/xenocara/app/xenodm/config/Xsession.in,v
> retrieving revision 1.2
> diff -u -p -r1.2 Xsession.in
> --- app/xenodm//config/Xsession.in1 Jul 2022 20:42:06 -   1.2
> +++ app/xenodm//config/Xsession.in14 Nov 2022 16:47:03 -
> @@ -7,6 +7,7 @@ exec_prefix="@exec_prefix@"
>  # redirect errors to a file in user's home directory if we can
>  
>  errfile="$HOME/.xsession-errors"
> +cp -f "$errfile" "$errfile.old" 2> /dev/null
>  if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
>  then
>   exec > "$errfile" 2>&1



Re: rc.subr: implement rc_execdir

2022-05-22 Thread Aaron Bieber



On Sun, May 22, 2022, at 8:50 AM, Aaron Bieber wrote:
> On Sun, May 22, 2022, at 8:32 AM, aisha wrote:
>> tested with calibre-web, vaultwarden and redmine, everything is working 
>> fine :)
>>
>> thanks a lot!
>>
>
> Navidrome working as well!

Forgot to add: OK abieber@ :D

>
>> On 5/22/2022 4:12 AM, Antoine Jacoutot wrote:
>>> Here's new diff that implements daemon_execdir.
>>>
>>> Index: etc/rc.d/rc.subr
>>> ===
>>> RCS file: /cvs/src/etc/rc.d/rc.subr,v
>>> retrieving revision 1.153
>>> diff -u -p -r1.153 rc.subr
>>> --- etc/rc.d/rc.subr21 May 2022 10:50:09 -  1.153
>>> +++ etc/rc.d/rc.subr22 May 2022 08:10:04 -
>>> @@ -49,7 +49,7 @@ _rc_parse_conf() {
>>> while IFS=' ' read -r _l; do
>>> [[ $_l == [!#=]*=* ]] || continue
>>> _key=${_l%%*([[:blank:]])=*}
>>> -   [[ $_key == *_@(flags|logger|rtable|timeout|user) ]] ||
>>> +   [[ $_key == 
>>> *_@(execdir|flags|logger|rtable|timeout|user) ]] ||
>>> [[ " ${_allowed_keys[*]} " == *" $_key "* ]] ||
>>> continue
>>> [[ $_key == "" ]] && continue
>>> @@ -114,14 +114,17 @@ _rc_write_runfile() {
>>> [ -d ${_RC_RUNDIR} ] || mkdir -p ${_RC_RUNDIR} &&
>>> cat >${_RC_RUNFILE} <>>   daemon_class=${daemon_class}
>>> +daemon_execdir=${daemon_execdir}
>>>   daemon_flags=${daemon_flags}
>>>   daemon_logger=${daemon_logger}
>>>   daemon_rtable=${daemon_rtable}
>>>   daemon_timeout=${daemon_timeout}
>>>   daemon_user=${daemon_user}
>>>   pexp=${pexp}
>>> +rc_reload=${rc_reload}
>>>   rc_reload_signal=${rc_reload_signal}
>>>   rc_stop_signal=${rc_stop_signal}
>>> +rc_usercheck=${rc_usercheck}
>>>   EOF
>>>   }
>>>   
>>> @@ -164,8 +167,11 @@ rc_exec() {
>>> [ "${daemon_rtable}" -eq "$(id -R)" ] ||
>>> _rcexec="route -T ${daemon_rtable} exec ${_rcexec}"
>>>   
>>> -   ${_rcexec} "${daemon_logger:+set -o pipefail; }$@${daemon_logger:+ 2>&1 
>>> |
>>> -   logger -ip ${daemon_logger} -t ${_name}}"
>>> +   ${_rcexec} "${daemon_logger:+set -o pipefail; } \
>>> +   ${daemon_execdir:+cd ${daemon_execdir} && } \
>>> +   $@ \
>>> +   ${daemon_logger:+ 2>&1 |
>>> +   logger -ip ${daemon_logger} -t ${_name}}"
>>>   }
>>>   
>>>   rc_start() {
>>> @@ -317,6 +323,7 @@ _rc_do _rc_parse_conf
>>>   rc_reload_signal=${rc_reload_signal:=HUP}
>>>   rc_stop_signal=${rc_stop_signal:=TERM}
>>>   
>>> +eval _rcexecdir=\${${_name}_execdir}
>>>   eval _rcflags=\${${_name}_flags}
>>>   eval _rclogger=\${${_name}_logger}
>>>   eval _rcrtable=\${${_name}_rtable}
>>> @@ -334,6 +341,7 @@ getcap -f /etc/login.conf.d/${_name}:/et
>>>   [ -n "${_RC_FORCE}" -o "$1" != "start" ] && [ X"${_rcflags}" = X"NO" ] &&
>>> unset _rcflags
>>>   
>>> +[ -n "${_rcexecdir}" ] && daemon_execdir=${_rcexecdir}
>>>   [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>>>   [ -n "${_rclogger}" ] && daemon_logger=${_rclogger}
>>>   [ -n "${_rcrtable}" ] && daemon_rtable=${_rcrtable}
>>> @@ -347,7 +355,7 @@ if [ -n "${_RC_DEBUG}" ]; then
>>>   fi
>>>   
>>>   readonly daemon_class
>>> -unset _rcflags _rclogger _rcrtable _rctimeout _rcuser
>>> +unset _rcexecdir _rcflags _rclogger _rcrtable _rctimeout _rcuser
>>>   # the shell will strip the quotes from daemon_flags when starting a 
>>> daemon;
>>>   # make sure pexp matches the process (i.e. doesn't include the quotes)
>>>   pexp="$(eval echo ${daemon}${daemon_flags:+ ${daemon_flags}})"
>>> Index: usr.sbin/rcctl/rcctl.8
>>> ===
>>> RCS file: /cvs/src/usr.sbin/rcctl/rcctl.8,v
>>> retrieving revision 1.39
>>> diff -u -p -r1.39 rcctl.8
>>> --- usr.sbin/rcctl/rcctl.8  1 Apr 2022 10:13:35 -   1.39
>>> +++ u

Re: rc.subr: implement rc_execdir

2022-05-22 Thread Aaron Bieber



On Sun, May 22, 2022, at 8:32 AM, aisha wrote:
> tested with calibre-web, vaultwarden and redmine, everything is working 
> fine :)
>
> thanks a lot!
>

Navidrome working as well!

> On 5/22/2022 4:12 AM, Antoine Jacoutot wrote:
>> Here's new diff that implements daemon_execdir.
>>
>> Index: etc/rc.d/rc.subr
>> ===
>> RCS file: /cvs/src/etc/rc.d/rc.subr,v
>> retrieving revision 1.153
>> diff -u -p -r1.153 rc.subr
>> --- etc/rc.d/rc.subr 21 May 2022 10:50:09 -  1.153
>> +++ etc/rc.d/rc.subr 22 May 2022 08:10:04 -
>> @@ -49,7 +49,7 @@ _rc_parse_conf() {
>>  while IFS=' ' read -r _l; do
>>  [[ $_l == [!#=]*=* ]] || continue
>>  _key=${_l%%*([[:blank:]])=*}
>> -[[ $_key == *_@(flags|logger|rtable|timeout|user) ]] ||
>> +[[ $_key == 
>> *_@(execdir|flags|logger|rtable|timeout|user) ]] ||
>>  [[ " ${_allowed_keys[*]} " == *" $_key "* ]] ||
>>  continue
>>  [[ $_key == "" ]] && continue
>> @@ -114,14 +114,17 @@ _rc_write_runfile() {
>>  [ -d ${_RC_RUNDIR} ] || mkdir -p ${_RC_RUNDIR} &&
>>  cat >${_RC_RUNFILE} <>   daemon_class=${daemon_class}
>> +daemon_execdir=${daemon_execdir}
>>   daemon_flags=${daemon_flags}
>>   daemon_logger=${daemon_logger}
>>   daemon_rtable=${daemon_rtable}
>>   daemon_timeout=${daemon_timeout}
>>   daemon_user=${daemon_user}
>>   pexp=${pexp}
>> +rc_reload=${rc_reload}
>>   rc_reload_signal=${rc_reload_signal}
>>   rc_stop_signal=${rc_stop_signal}
>> +rc_usercheck=${rc_usercheck}
>>   EOF
>>   }
>>   
>> @@ -164,8 +167,11 @@ rc_exec() {
>>  [ "${daemon_rtable}" -eq "$(id -R)" ] ||
>>  _rcexec="route -T ${daemon_rtable} exec ${_rcexec}"
>>   
>> -${_rcexec} "${daemon_logger:+set -o pipefail; }$@${daemon_logger:+ 2>&1 
>> |
>> -logger -ip ${daemon_logger} -t ${_name}}"
>> +${_rcexec} "${daemon_logger:+set -o pipefail; } \
>> +${daemon_execdir:+cd ${daemon_execdir} && } \
>> +$@ \
>> +${daemon_logger:+ 2>&1 |
>> +logger -ip ${daemon_logger} -t ${_name}}"
>>   }
>>   
>>   rc_start() {
>> @@ -317,6 +323,7 @@ _rc_do _rc_parse_conf
>>   rc_reload_signal=${rc_reload_signal:=HUP}
>>   rc_stop_signal=${rc_stop_signal:=TERM}
>>   
>> +eval _rcexecdir=\${${_name}_execdir}
>>   eval _rcflags=\${${_name}_flags}
>>   eval _rclogger=\${${_name}_logger}
>>   eval _rcrtable=\${${_name}_rtable}
>> @@ -334,6 +341,7 @@ getcap -f /etc/login.conf.d/${_name}:/et
>>   [ -n "${_RC_FORCE}" -o "$1" != "start" ] && [ X"${_rcflags}" = X"NO" ] &&
>>  unset _rcflags
>>   
>> +[ -n "${_rcexecdir}" ] && daemon_execdir=${_rcexecdir}
>>   [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>>   [ -n "${_rclogger}" ] && daemon_logger=${_rclogger}
>>   [ -n "${_rcrtable}" ] && daemon_rtable=${_rcrtable}
>> @@ -347,7 +355,7 @@ if [ -n "${_RC_DEBUG}" ]; then
>>   fi
>>   
>>   readonly daemon_class
>> -unset _rcflags _rclogger _rcrtable _rctimeout _rcuser
>> +unset _rcexecdir _rcflags _rclogger _rcrtable _rctimeout _rcuser
>>   # the shell will strip the quotes from daemon_flags when starting a daemon;
>>   # make sure pexp matches the process (i.e. doesn't include the quotes)
>>   pexp="$(eval echo ${daemon}${daemon_flags:+ ${daemon_flags}})"
>> Index: usr.sbin/rcctl/rcctl.8
>> ===
>> RCS file: /cvs/src/usr.sbin/rcctl/rcctl.8,v
>> retrieving revision 1.39
>> diff -u -p -r1.39 rcctl.8
>> --- usr.sbin/rcctl/rcctl.8   1 Apr 2022 10:13:35 -   1.39
>> +++ usr.sbin/rcctl/rcctl.8   22 May 2022 08:10:04 -
>> @@ -62,6 +62,7 @@ The following commands are available
>>   .Ar variable
>>   can be one of
>>   .Cm class ,
>> +.Cm execdir ,
>>   .Cm flags ,
>>   .Cm logger ,
>>   .Cm rtable ,
>> @@ -206,7 +207,8 @@ flags:
>>   # rcctl set apmd flags -A
>>   # rcctl get apmd
>>   apmd_class=daemon
>> -apmd_flags=-A
>> +apmd_execdir=
>> +apmd_flags=NO
>>   apmd_logger=
>>   apmd_rtable=0
>>   apmd_timeout=30
>> Index: usr.sbin/rcctl/rcctl.sh
>> ===
>> RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
>> retrieving revision 1.112
>> diff -u -p -r1.112 rcctl.sh
>> --- usr.sbin/rcctl/rcctl.sh  10 Feb 2022 16:57:33 -  1.112
>> +++ usr.sbin/rcctl/rcctl.sh  22 May 2022 08:10:04 -
>> @@ -258,8 +258,8 @@ svc_get()
>>  [ -n "${_svc}" ] || return
>>   
>>  local _status=0 _val _var=$2
>> -local daemon_class daemon_flags daemon_logger daemon_rtable
>> -local daemon_timeout daemon_user
>> +local daemon_class daemon_execdir daemon_flags daemon_logger
>> +local daemon_rtable daemon_timeout daemon_user
>>   
>>  if svc_is_special ${_svc}; then
>>  daemon_flags="$(eval echo \${${_svc}})"
>> @@ -279,6 +279,12 @@ 

Re: rc.subr: implement rc_execdir

2022-05-21 Thread Aaron Bieber



On Sat, May 21, 2022, at 3:48 PM, Antoine Jacoutot wrote:
> Can you give me real life examples please where it would be useful. 
> I don’t want to add configuration knob for a couple of obscur use cases. 

audio/navidrome

And there is something else .. I’ll have to look.

>
> Thanks. 
>
> —
> Antoine
>
>> On 21 May 2022, at 22:26, Aaron Bieber  wrote:
>> 
>> 
>> 
>>> On Sat, May 21, 2022, at 10:56 AM, aisha wrote:
>>>> On 5/21/2022 12:24 PM, Antoine Jacoutot wrote:
>>>> On Sat, May 21, 2022 at 12:04:03PM -0400, A Tammy wrote:
>>>>> On 5/21/2022 10:53 AM, Antoine Jacoutot wrote:
>>>>>> Hi.
>>>>>> 
>>>>>> This diff allows to configure an directory from which we run rc.d 
>>>>>> commands.
>>>>>> This can be useful for daemons that must cd into a specific directory 
>>>>>> prio
>>>>>> launching.
>>>>>> 
>>>>>> Here's an example for the automounter.
>>>>>> Some rc.d scripts in ports can benefit from this as well (so we can 
>>>>>> remove
>>>>>> handcrafted rc_start function and use the default).
>>>>>> 
>>>>>> Comments / OK?
>>>>>> 
>>>>>> Index: amd
>>>>>> ===
>>>>>> RCS file: /cvs/src/etc/rc.d/amd,v
>>>>>> retrieving revision 1.9
>>>>>> diff -u -p -r1.9 amd
>>>>>> --- amd11 Jan 2018 21:09:26 -1.9
>>>>>> +++ amd21 May 2022 14:52:07 -
>>>>>> @@ -7,16 +7,13 @@ daemon="/usr/sbin/amd"
>>>>>>   . /etc/rc.d/rc.subr
>>>>>>   pexp="${daemon}.*"
>>>>>> +rc_execdir=/etc/amd
>>>>>>   rc_reload=NO
>>>>>>   rc_stop=NO
>>>>>>   rc_pre() {
>>>>>>   [[ -e ${amd_master} ]] || return 1
>>>>>>   daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))"
>>>>>> -}
>>>>>> -
>>>>>> -rc_start() {
>>>>>> -${rcexec} "cd /etc/amd; ${daemon} ${daemon_flags}"
>>>>>>   }
>>>>>>   rc_cmd $1
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Index: etc/rc.d/rc.subr
>>>>>> ===
>>>>>> RCS file: /cvs/src/etc/rc.d/rc.subr,v
>>>>>> retrieving revision 1.153
>>>>>> diff -u -p -r1.153 rc.subr
>>>>>> --- etc/rc.d/rc.subr21 May 2022 10:50:09 -1.153
>>>>>> +++ etc/rc.d/rc.subr21 May 2022 14:49:17 -
>>>>>> @@ -164,8 +164,11 @@ rc_exec() {
>>>>>>   [ "${daemon_rtable}" -eq "$(id -R)" ] ||
>>>>>>   _rcexec="route -T ${daemon_rtable} exec ${_rcexec}"
>>>>>> -${_rcexec} "${daemon_logger:+set -o pipefail; }$@${daemon_logger:+ 
>>>>>> 2>&1 |
>>>>>> -logger -ip ${daemon_logger} -t ${_name}}"
>>>>>> +${_rcexec} "${daemon_logger:+set -o pipefail; } \
>>>>>> +${rc_execdir:+cd ${rc_execdir} && } \
>>>>>> +$@ \
>>>>>> +${daemon_logger:+ 2>&1 |
>>>>>> +logger -ip ${daemon_logger} -t ${_name}}"
>>>>>>   }
>>>>>>   rc_start() {
>>>>>> Index: share/man/man8/rc.subr.8
>>>>>> ===
>>>>>> RCS file: /cvs/src/share/man/man8/rc.subr.8,v
>>>>>> retrieving revision 1.43
>>>>>> diff -u -p -r1.43 rc.subr.8
>>>>>> --- share/man/man8/rc.subr.821 May 2022 14:11:39 -1.43
>>>>>> +++ share/man/man8/rc.subr.821 May 2022 14:49:17 -
>>>>>> @@ -194,9 +194,10 @@ Execute process using
>>>>>>   according to
>>>>>>   .Va daemon_class ,
>>>>>>   .Va daemon_user ,
>>>>>> -.Va daemon_rtable
>>>>>> -and
>>>>>> +.Va daemon_rtable ,
>>>>>>   .Va daemon_logger
>>>>>> +and
>>>>>> +.Va rc_execdir
>>>>&g

Re: rc.subr: implement rc_execdir

2022-05-21 Thread Aaron Bieber



On Sat, May 21, 2022, at 10:56 AM, aisha wrote:
> On 5/21/2022 12:24 PM, Antoine Jacoutot wrote:
>> On Sat, May 21, 2022 at 12:04:03PM -0400, A Tammy wrote:
>>> On 5/21/2022 10:53 AM, Antoine Jacoutot wrote:
 Hi.

 This diff allows to configure an directory from which we run rc.d commands.
 This can be useful for daemons that must cd into a specific directory prio
 launching.

 Here's an example for the automounter.
 Some rc.d scripts in ports can benefit from this as well (so we can remove
 handcrafted rc_start function and use the default).

 Comments / OK?

 Index: amd
 ===
 RCS file: /cvs/src/etc/rc.d/amd,v
 retrieving revision 1.9
 diff -u -p -r1.9 amd
 --- amd11 Jan 2018 21:09:26 -  1.9
 +++ amd21 May 2022 14:52:07 -
 @@ -7,16 +7,13 @@ daemon="/usr/sbin/amd"
. /etc/rc.d/rc.subr
pexp="${daemon}.*"
 +rc_execdir=/etc/amd
rc_reload=NO
rc_stop=NO
rc_pre() {
[[ -e ${amd_master} ]] || return 1
daemon_flags="${daemon_flags} $(print -rn -- $(< 
 ${amd_master}))"
 -}
 -
 -rc_start() {
 -  ${rcexec} "cd /etc/amd; ${daemon} ${daemon_flags}"
}
rc_cmd $1



 Index: etc/rc.d/rc.subr
 ===
 RCS file: /cvs/src/etc/rc.d/rc.subr,v
 retrieving revision 1.153
 diff -u -p -r1.153 rc.subr
 --- etc/rc.d/rc.subr   21 May 2022 10:50:09 -  1.153
 +++ etc/rc.d/rc.subr   21 May 2022 14:49:17 -
 @@ -164,8 +164,11 @@ rc_exec() {
[ "${daemon_rtable}" -eq "$(id -R)" ] ||
_rcexec="route -T ${daemon_rtable} exec ${_rcexec}"
 -  ${_rcexec} "${daemon_logger:+set -o pipefail; }$@${daemon_logger:+ 2>&1 
 |
 -  logger -ip ${daemon_logger} -t ${_name}}"
 +  ${_rcexec} "${daemon_logger:+set -o pipefail; } \
 +  ${rc_execdir:+cd ${rc_execdir} && } \
 +  $@ \
 +  ${daemon_logger:+ 2>&1 |
 +  logger -ip ${daemon_logger} -t ${_name}}"
}
rc_start() {
 Index: share/man/man8/rc.subr.8
 ===
 RCS file: /cvs/src/share/man/man8/rc.subr.8,v
 retrieving revision 1.43
 diff -u -p -r1.43 rc.subr.8
 --- share/man/man8/rc.subr.8   21 May 2022 14:11:39 -  1.43
 +++ share/man/man8/rc.subr.8   21 May 2022 14:49:17 -
 @@ -194,9 +194,10 @@ Execute process using
according to
.Va daemon_class ,
.Va daemon_user ,
 -.Va daemon_rtable
 -and
 +.Va daemon_rtable ,
.Va daemon_logger
 +and
 +.Va rc_execdir
>>> Is there a reason why you've chosen it to be rc_execdir instead of
>>> daemon_execdir?
>>> Calling it `daemon_execdir` (and possibly allowing it to be modified from
>>> /etc/rc.conf.local)
>>> would be inline with other daemon_* variables.
>>> The first thing that comes to my mind would be people who want to start
>>> multiple copies of
>>> a daemon, e.g. navidrome or calibre-web, create libraries in the start
>>> directory.
>>> I personally don't have anything except calibre-web, so no strong opinions
>>> on this.
>> I wondered the same but came to the conclusion there where not that many use
>> cases and implementing rc_ is easier.
>> Going for daemon_ will mean changing rcctl as well.
>>
>> I have no strong preference honestly.
>> If people think it will be handy to change this in rc.conf.local, I will
>> change the implementation.
> In that case, my vote is for it to be called daemon_execdir :)

Mine too! :D

>>> Also, if it is decided to keep it rc_execdir, does it need to be added to
>>> the man page?
>>> It is not something thats going to be exposed user side.
>> Yes it is needed.
>> It is exposed to people creating rc.d scripts; which is exactly what
>> rc.subr(8) is for.
>> Users will read rc.d(8).
>> Also that kind of contradicts your point for using daemon_
>>
>>
values.
.It Ic rc_reload
Send the
 @@ -305,6 +306,9 @@ in an
.Nm rc.d
script to force starting the daemon in background when using the default
.Ic rc_start .
 +.It Va rc_execdir
 +Change to this directory before running
 +.Ic rc_exec .
.It Va rc_reload
Can be set to
.Dq NO





Re: rc.subr - allow setting daemon start directory

2022-05-05 Thread Aaron Bieber



On Thu, May 5, 2022, at 4:46 PM, Antoine Jacoutot wrote:
> Can you elaborate?
> Do they need to start from a specific directory or from a directory 
> they have write access to?
> Because we could cd /tmp unconditionally 
>

>From a specific directory. I can’t think of which ones off the top of my head, 
>but for sure I have some personal rc scripts that need it for nodejs things.

> —
> Antoine
>
>> On 6 May 2022, at 00:43, Aaron Bieber  wrote:
>> 
>> 
>> 
>>> On Thu, May 5, 2022, at 3:24 PM, Antoine Jacoutot wrote:
>>> Not a fan adding a knob for this. 
>>> I don’t remember why amd needs to start from /etc/amd. 
>>> 
>>> —
>>> Antoine
>> 
>> There are a number of ports that would benefit from this as well.
>> 
>>> 
>>>>> On 5 May 2022, at 23:12, aisha  wrote:
>>>> 
>>>> Hi,
>>>> I've attached a patch which allows setting the daemon start directory 
>>>> using the variable `daemon_startdir`.
>>>> I think this is useful in the cases where it is desirable to change the 
>>>> start directory before running the daemon, e.g. with /etc/rc.d/amd .
>>>> A major benefit of this is that this allows setting the start directory 
>>>> manually while also allowing the use of daemon_logger, which gets lost in 
>>>> case someone writes their own rc_start (again, amd is an example).
>>>> 
>>>> This is not always possible using the rcexec which uses `su -l` as the 
>>>> daemon might be running as root (or if user has home directory to 
>>>> /nonexistent).
>>>> 
>>>> Thanks,
>>>> Aisha
>>>> 
>>>> diff --git a/etc/rc.d/amd b/etc/rc.d/amd
>>>> index 3bfe9dc555e..5c1b8a897ed 100644
>>>> --- a/etc/rc.d/amd
>>>> +++ b/etc/rc.d/amd
>>>> @@ -3,6 +3,7 @@
>>>> # $OpenBSD: amd,v 1.9 2018/01/11 21:09:26 rpe Exp $
>>>> 
>>>> daemon="/usr/sbin/amd"
>>>> +daemon_startdir="/etc/amd"
>>>> 
>>>> . /etc/rc.d/rc.subr
>>>> 
>>>> @@ -15,8 +16,4 @@ rc_pre() {
>>>>   daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))"
>>>> }
>>>> 
>>>> -rc_start() {
>>>> -${rcexec} "cd /etc/amd; ${daemon} ${daemon_flags}"
>>>> -}
>>>> -
>>>> rc_cmd $1
>>>> diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
>>>> index ed2adb6515e..035f8d9b172 100644
>>>> --- a/etc/rc.d/rc.subr
>>>> +++ b/etc/rc.d/rc.subr
>>>> @@ -117,6 +117,7 @@ daemon_class=${daemon_class}
>>>> daemon_flags=${daemon_flags}
>>>> daemon_logger=${daemon_logger}
>>>> daemon_rtable=${daemon_rtable}
>>>> +daemon_startdir=${daemon_startdir}
>>>> daemon_timeout=${daemon_timeout}
>>>> daemon_user=${daemon_user}
>>>> pexp=${pexp}
>>>> @@ -160,7 +161,7 @@ _rc_wait_for_start() {
>>>> }
>>>> 
>>>> rc_start() {
>>>> -${rcexec} "${daemon_logger:+set -o pipefail; }${daemon} 
>>>> ${daemon_flags}${daemon_logger:+ 2>&1 |
>>>> +${rcexec} "${daemon_logger:+set -o pipefail; }${daemon_startdir:+cd 
>>>> ${daemon_startdir}; }${daemon} ${daemon_flags}${daemon_logger:+ 2>&1 |
>>>>   logger -ip ${daemon_logger} -t ${_name}}"
>>>> }
>>>> 
>>>> @@ -312,6 +313,7 @@ rc_stop_signal=${rc_stop_signal:=TERM}
>>>> eval _rcflags=\${${_name}_flags}
>>>> eval _rclogger=\${${_name}_logger}
>>>> eval _rcrtable=\${${_name}_rtable}
>>>> +eval _rcstartdir=\${${_name}_startdir}
>>>> eval _rctimeout=\${${_name}_timeout}
>>>> eval _rcuser=\${${_name}_user}
>>>> 
>>>> @@ -329,6 +331,7 @@ getcap -f /etc/login.conf.d/${_name}:/etc/login.conf 
>>>> ${_name} 1>/dev/null 2>&1 &
>>>> [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>>>> [ -n "${_rclogger}" ] && daemon_logger=${_rclogger}
>>>> [ -n "${_rcrtable}" ] && daemon_rtable=${_rcrtable}
>>>> +[ -n "${_rcstartdir}" ] && daemon_startdir=${_rcstartdir}
>>>> [ -n "${_rctimeout}" ] && daemon_timeout=${_rctimeout}
>>>> [ -n "${_rcuser}" ] && daemon_user=${_rcuser}
>>>> 
>>>> 
>>



Re: rc.subr - allow setting daemon start directory

2022-05-05 Thread Aaron Bieber



On Thu, May 5, 2022, at 3:24 PM, Antoine Jacoutot wrote:
> Not a fan adding a knob for this. 
> I don’t remember why amd needs to start from /etc/amd. 
>
> —
> Antoine

There are a number of ports that would benefit from this as well.

>
>> On 5 May 2022, at 23:12, aisha  wrote:
>> 
>> Hi,
>>  I've attached a patch which allows setting the daemon start directory using 
>> the variable `daemon_startdir`.
>> I think this is useful in the cases where it is desirable to change the 
>> start directory before running the daemon, e.g. with /etc/rc.d/amd .
>> A major benefit of this is that this allows setting the start directory 
>> manually while also allowing the use of daemon_logger, which gets lost in 
>> case someone writes their own rc_start (again, amd is an example).
>> 
>> This is not always possible using the rcexec which uses `su -l` as the 
>> daemon might be running as root (or if user has home directory to 
>> /nonexistent).
>> 
>> Thanks,
>> Aisha
>> 
>> diff --git a/etc/rc.d/amd b/etc/rc.d/amd
>> index 3bfe9dc555e..5c1b8a897ed 100644
>> --- a/etc/rc.d/amd
>> +++ b/etc/rc.d/amd
>> @@ -3,6 +3,7 @@
>> # $OpenBSD: amd,v 1.9 2018/01/11 21:09:26 rpe Exp $
>> 
>> daemon="/usr/sbin/amd"
>> +daemon_startdir="/etc/amd"
>> 
>> . /etc/rc.d/rc.subr
>> 
>> @@ -15,8 +16,4 @@ rc_pre() {
>>daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))"
>> }
>> 
>> -rc_start() {
>> -${rcexec} "cd /etc/amd; ${daemon} ${daemon_flags}"
>> -}
>> -
>> rc_cmd $1
>> diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
>> index ed2adb6515e..035f8d9b172 100644
>> --- a/etc/rc.d/rc.subr
>> +++ b/etc/rc.d/rc.subr
>> @@ -117,6 +117,7 @@ daemon_class=${daemon_class}
>> daemon_flags=${daemon_flags}
>> daemon_logger=${daemon_logger}
>> daemon_rtable=${daemon_rtable}
>> +daemon_startdir=${daemon_startdir}
>> daemon_timeout=${daemon_timeout}
>> daemon_user=${daemon_user}
>> pexp=${pexp}
>> @@ -160,7 +161,7 @@ _rc_wait_for_start() {
>> }
>> 
>> rc_start() {
>> -${rcexec} "${daemon_logger:+set -o pipefail; }${daemon} 
>> ${daemon_flags}${daemon_logger:+ 2>&1 |
>> +${rcexec} "${daemon_logger:+set -o pipefail; }${daemon_startdir:+cd 
>> ${daemon_startdir}; }${daemon} ${daemon_flags}${daemon_logger:+ 2>&1 |
>>logger -ip ${daemon_logger} -t ${_name}}"
>> }
>> 
>> @@ -312,6 +313,7 @@ rc_stop_signal=${rc_stop_signal:=TERM}
>> eval _rcflags=\${${_name}_flags}
>> eval _rclogger=\${${_name}_logger}
>> eval _rcrtable=\${${_name}_rtable}
>> +eval _rcstartdir=\${${_name}_startdir}
>> eval _rctimeout=\${${_name}_timeout}
>> eval _rcuser=\${${_name}_user}
>> 
>> @@ -329,6 +331,7 @@ getcap -f /etc/login.conf.d/${_name}:/etc/login.conf 
>> ${_name} 1>/dev/null 2>&1 &
>> [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>> [ -n "${_rclogger}" ] && daemon_logger=${_rclogger}
>> [ -n "${_rcrtable}" ] && daemon_rtable=${_rcrtable}
>> +[ -n "${_rcstartdir}" ] && daemon_startdir=${_rcstartdir}
>> [ -n "${_rctimeout}" ] && daemon_timeout=${_rctimeout}
>> [ -n "${_rcuser}" ] && daemon_user=${_rcuser}
>> 
>>



Re: vmm(4): improve {rd,wr}msr exit handling for both amd & intel

2021-04-05 Thread Aaron Bieber


Dave Voutila writes:

> Dave Voutila writes:
>
>> The following diff cleans up and improves MSR-related event handling in
>> vmm(4) for when the guest attempts a rdmsr/wrmsr instruction. As
>> mentioned in a previous email to tech@ about fixing support for 9front
>> guests [1], we found some discprepencies between vmm(4)'s handling on
>> Intel hosts and AMD hosts.
>>
>> While the diff has been tested already by abieber@ and brynet@ with
>> additional review by mlarkin@, I'm looking for additional testers
>> willing to look for regressions.

Confirmed it's working for me - very latest 9front and nixos work fine
on my ryzen!

>
> Last call for additional testers. Plan is to commit the diff later today
> as I have an OK from mlarkin@.
>
>>
>> This diff specifically improves and standardizes msr-based exit handling
>> between Intel and AMD hosts to the following:
>>
>> 1. All RDMSR instructions that cause a vm-exit must be explicitly
>>handled (e.g. via emulation) or they result in injecting a #GP
>>exception into the guest.
>>
>> 2. All WRMSR instructions that cause a vm-exit and are not explicitly
>>handled are ignored (i.e. %rax and %rdx values are not inspected or
>>used).
>>
>> Consequently with the change for (1) above, the diff adds explicit
>> handling for the following MSRs:
>>
>> 1. MSR_CR_PAT: for now reads/writes are shadowed for the guest vcpu and
>>host state is not touched. The shadow state is initialized on vcpu
>>reset to the same value as the host.
>>
>> 2. MSR_BIOS_SIGN, MSR_INT_PEN_MSG (on AMD), and MSR_PLATFORM_ID are all
>>ignored. This means reads result in vmm(4) setting the guest vcpu's
>>%rax and %rdx to 0. (These msr's are ignored in the same manner by
>>other hypervisors like kvm and nvmm.)
>>
>> The average user should not see a change in behavior of vmm(4) or
>> vmd(8). The biggest change is for *Intel* users as this diff changes the
>> current vmx logic which was not injecting #GP for unsupported
>> msr's. (Your guests were potentially getting garbage results from rdmsr
>> instructions.)
>>
>
> If you do test the diff and have issues, I forgot to mention to please
> build the kernel with VMM_DEBUG. The output to the kernel buffer will
> help diagnose any problematic msr access.
>
>> The folks attempting to host the latest release of 9front as a guest on
>> AMD hosts should see their guest boot successfully with this diff :-)
>>
>> -dv
>>
>> [1] https://marc.info/?l=openbsd-tech=161693517121814=2
>>
>>
>> Index: sys/arch/amd64/include/vmmvar.h
>> ===
>> RCS file: /cvs/src/sys/arch/amd64/include/vmmvar.h,v
>> retrieving revision 1.70
>> diff -u -p -r1.70 vmmvar.h
>> --- sys/arch/amd64/include/vmmvar.h  8 Apr 2020 07:39:48 -   1.70
>> +++ sys/arch/amd64/include/vmmvar.h  31 Mar 2021 00:15:43 -
>> @@ -936,6 +936,9 @@ struct vcpu {
>>  paddr_t vc_pvclock_system_gpa;
>>  uint32_t vc_pvclock_system_tsc_mul;
>>
>> +/* Shadowed MSRs */
>> +uint64_t vc_shadow_pat;
>> +
>>  /* VMX only */
>>  uint64_t vc_vmx_basic;
>>  uint64_t vc_vmx_entry_ctls;
>> Index: sys/arch/amd64/amd64/vmm.c
>> ===
>> RCS file: /cvs/src/sys/arch/amd64/amd64/vmm.c,v
>> retrieving revision 1.278
>> diff -u -p -r1.278 vmm.c
>> --- sys/arch/amd64/amd64/vmm.c   11 Mar 2021 11:16:55 -  1.278
>> +++ sys/arch/amd64/amd64/vmm.c   31 Mar 2021 00:15:43 -
>> @@ -207,6 +207,7 @@ void svm_set_dirty(struct vcpu *, uint32
>>  int vmm_gpa_is_valid(struct vcpu *vcpu, paddr_t gpa, size_t obj_size);
>>  void vmm_init_pvclock(struct vcpu *, paddr_t);
>>  int vmm_update_pvclock(struct vcpu *);
>> +int vmm_pat_is_valid(uint64_t);
>>
>>  #ifdef VMM_DEBUG
>>  void dump_vcpu(struct vcpu *);
>> @@ -3193,6 +3194,9 @@ vcpu_reset_regs_vmx(struct vcpu *vcpu, s
>>  /* xcr0 power on default sets bit 0 (x87 state) */
>>  vcpu->vc_gueststate.vg_xcr0 = XCR0_X87 & xsave_mask;
>>
>> +/* XXX PAT shadow */
>> +vcpu->vc_shadow_pat = rdmsr(MSR_CR_PAT);
>> +
>>  exit:
>>  /* Flush the VMCS */
>>  if (vmclear(>vc_control_pa)) {
>> @@ -3584,6 +3588,10 @@ vcpu_init(struct vcpu *vcpu)
>>  vcpu->vc_state = VCPU_STATE_STOPPED;
>>  vcpu->vc_vpid = 0;
>>  vcpu->vc_pvclock_system_gpa = 0;
>> +
>> +/* Shadow PAT MSR, starting with host's value. */
>> +vcpu->vc_shadow_pat = rdmsr(MSR_CR_PAT);
>> +
>>  if (vmm_softc->mode == VMM_MODE_VMX ||
>>  vmm_softc->mode == VMM_MODE_EPT)
>>  ret = vcpu_init_vmx(vcpu);
>> @@ -6257,26 +6265,24 @@ vmx_handle_rdmsr(struct vcpu *vcpu)
>>  rdx = >vc_gueststate.vg_rdx;
>>
>>  switch (*rcx) {
>> -case MSR_SMBASE:
>> -/*
>> - * 34.15.6.3 - Saving Guest State (SMM)
>> - *
>> - * Unsupported, so inject #GP and return without
>> - * advancing %rip.
>> - */
>> +case 

Re: update xterm to version 367

2021-04-01 Thread Aaron Bieber


Matthieu Herrb writes:

> On Sat, Mar 27, 2021 at 10:22:15AM +0100, Matthieu Herrb wrote:
>> Patch #367 - 2021/03/26
>> 
>> ok ? comments ?
>
> Hi,
>
> I could use some actual test results. I'd like to commit the update.

Seems to be working fine here!



Re: Permit reading kern.somaxconn with unix pledge

2021-03-25 Thread Aaron Bieber


Theo de Raadt writes:

> I have reviewed all the pledge using programs in the tree, and I do not
> see additional risk from this change.
>
> Who wants to take care of the commit?

I'll snag it!

>
> Josh Rickmar  wrote:
>
>> The kern.somaxconn sysctl was previously permitted under the inet
>> pledge, which allowed pledged Go applications to listen on AF_INET and
>> AF_INET6 domains.
>> 
>> https://marc.info/?l=openbsd-tech=158069595809463=2
>> https://marc.info/?l=openbsd-cvs=158081099810301=2
>> 
>> But Go will also read this sysctl when only using unix domain sockets.
>> The patch below additionally permits reading this sysctl if the unix
>> pledge is granted.
>> 
>> Note that for this to be tested and useful (where useful means not
>> running with the inet pledge), Go's net package also needs a patch:
>> https://gist.github.com/jrick/878236e2f3735d35d5a737936439cb81
>> 
>> diff b17f936e67043f9c006633bac4e3630f86dd05c2 /usr/src
>> blob - 9ffb7f2ffb9d05d6dd741e180b62141fb5e91f0b
>> file + sys/kern/kern_pledge.c
>> --- sys/kern/kern_pledge.c
>> +++ sys/kern/kern_pledge.c
>> @@ -888,7 +888,7 @@ pledge_sysctl(struct proc *p, int miblen, int *mib, vo
>>  return (0);
>>  }
>>  
>> -if ((p->p_p->ps_pledge & PLEDGE_INET)) {
>> +if ((p->p_p->ps_pledge & (PLEDGE_INET | PLEDGE_UNIX))) {
>>  if (miblen == 2 &&  /* kern.somaxconn */
>>  mib[0] == CTL_KERN && mib[1] == KERN_SOMAXCONN)
>>  return (0);
>> 



Re: Add note about example dhclient.conf

2020-02-07 Thread Aaron Bieber
On Fri, 07 Feb 2020 at 17:49:41 -0800, Kyle Isom wrote:
> I was looking through the dhclient.conf man page and missed that there was an 
> example config in /etc/examples, so  I added this to the man page. I'm also 
> happy to go through the rest of man pages for the examples and add them if 
> there's interest.
> 
> Cheers,
> Kyle
> 
> 
> Index: sbin/dhclient/dhclient.conf.5
> ===
> RCS file: /cvs/src/sbin/dhclient/dhclient.conf.5,v
> retrieving revision 1.49
> diff -u -p -u -p -r1.49 dhclient.conf.5
> --- sbin/dhclient/dhclient.conf.5 17 Dec 2019 14:21:54 -  1.49
> +++ sbin/dhclient/dhclient.conf.5 8 Feb 2020 00:22:38 -
> @@ -288,6 +288,11 @@ instead of the
>  .Ic sname
>  field of the DHCP offer when binding a lease.
>  .El
> +.Sh EXAMPLE
> +There is an example
> +.Pa dhclient.conf
> +in
> +.Pa /etc/examples/dhclient.conf .
>  .Sh SEE ALSO
>  .Xr dhclient.leases 5 ,
>  .Xr dhcp-options 5 ,
> 

IMO this is worth doing. acme-client.1 and httpd.conf.5 have reference to
/etc/examples, and I have run into a number of people that are unaware of the
existence of the examples.

Maybe something a bit more similar to what's in acme-client(1) which uses a
more standard EXAMPLES section:

.Sh EXAMPLES
Example configuration files for
.Nm
and
.Xr httpd 8
are provided in
.Pa /etc/examples/acme-client.conf

I talked with tj@ about this as well, he suggested another route would be to
add full examples in the lacking pages. IMO both approaches would probably be
beneficial but I think directing more attention to /etc/examples is a good
start.

Anyone else have any thoughts?

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: amdgpu (and possible radeondrm) fix

2020-01-21 Thread Aaron Bieber
On Wed, 22 Jan 2020 at 03:10:01 +0100, Mark Kettenis wrote:
> The attached diff fixes amdgpu(4) and might very well fix radeondrm(4) as
> well.  The problems with the hardware cursor are gone, various screen
> corruptions no longer seem to happen and the laptop I have here suspends and
> resumes now.
> I still occasionally see some glitches playing youtube videos, but overall
> this seems to be huge improvement.

Fixes all the above for me!

> 
> Apologies for sending the diff as an attachment, but I'm stuck with having
> to use webmail at this moment.
> 
> ok?

OK abieber@


-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Remove NetChip from cdce

2019-11-13 Thread Aaron Bieber
Hi,

I have a raspberry pi 0 that attaches as:
  cdce0 at uhub0 port 3 configuration 2 interface 0 "Linux 4.19.75+ with \
2098.usb RNDIS/Ethernet Gadget" rev 2.00/4.19 addr 10

Unfortunately the cdce interface does not work with this particular device.

On the linux end, it turns out that cdc and rndis are being presented. When
NetChip is removed from the cdce driver, urndis(4) picks up the slack and
things work as expected! Linux also has the product id defined as RNDIS.

Debugged with patrick@ who is awesome and I now owe a beer or two for his
help! :D

OK?

Cheers,
Aaron

diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index abf0521ccd6..816bdc29c10 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -100,7 +100,6 @@ const struct cdce_type cdce_devs[] = {
 {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_CRC32 },
 {{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_CRC32 },
 {{ USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00 }, 0 },
-{{ USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET }, 0 },
 {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, 0 },
 {{ USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250 }, CDCE_SWAPUNION },
 };

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: Add Colemak keyboard encoding

2018-11-25 Thread Aaron Bieber
On Tue, 20 Nov 2018 at 19:36:55 -0700, Aaron Bieber wrote:
> On Fri, 16 Nov 2018 at 07:02:42 -0700, Aaron Bieber wrote:
> > On Fri, 16 Nov 2018 at 06:55:09 -0700, Aaron Bieber wrote:
> > > Hi,
> > >
> > > This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. 
> > > I
> > > have updated it to add the 'swapctrlcaps' bit and removed the xenocara 
> > > diff.
> > >
> > > https://marc.info/?l=openbsd-bugs=124284599329729
> > >
> > > Not sure if this didn't land because it was sent to bugs@ or if there are 
> > > other
> > > reasons. Please cluestick me if you know!
> > >
> > > OK?
> > >
> >
>
> Here is a much cleaner version of the diff which adds proper man
> entries and only modifies the keys that are different from KB_US.
>
> OK?

Ok, here is the latest version, it:

 - Fixes ukbdmap issue I had in the previous diff (spotted by
   thfr). Also ukbdmap's diff is generated via the make target.
 - Includes a diff for xenocara to add a colemak variant.

To test:

 - Apply, Build kernel / reboot
 - # cd /usr/src && make includes
 - # cd /usr/src/sbin/wsconsctl && make obj && make && make install
 - # wsconsctl keyboard.encoding=us.colemak

To test with xenocara:

  - Do above steps
  - Apply xenocara diff
  - Build xenocara as per README
  - Restart X

diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 45ad55d8765..0135c715bc0 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -162,6 +162,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DECLK
 .Pq us.declk
 English/US mapping for
@@ -180,7 +185,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
index af218fa0910..211516596dd 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -198,6 +198,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DVORAK
 .Pq us.dvorak
 English/US keyboard with
@@ -212,8 +217,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and
-KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index d10a909eece..8708ef96e11 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -597,6 +597,27 @@ static const keysym_t pckbd_keydesc_us_dvorak[] = {
 KC(53),KS_z,
 };

+static const keysym_t pckbd_keydesc_us_colemak[] = {
+/*  pos  command   normal  shifted */
+KC(18),KS_f,
+KC(19),KS_p,
+KC(20),KS_g,
+KC(21),KS_j,
+KC(22),KS_l,
+KC(23),KS_u,
+KC(24),KS_y,
+KC(25),KS_semicolon,   KS_colon,
+KC(31),KS_r,
+KC(32),KS_s,
+KC(33),KS_t,
+KC(34),KS_d,
+KC(36),KS_n,
+KC(37),KS_e,
+KC(38),KS_i,   KS_I,
+KC(39),KS_o,
+KC(49),KS_k,
+};
+
 static const keysym_t pckbd_keydesc_swapctrlcaps[] = {
 /*  pos  command   normal  shifted */
 KC(29),KS_Caps_Lock,
@@ -1129,6 +1150,7 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
KBD_MAP(KB_NO | KB_NODEAD,  KB_NO,  pckbd_keydesc_no_nodead),
KBD_MAP(KB_US | KB_DECLK,   KB_US,  pckbd_keydesc_us_declk),
KBD_MAP(KB_US | KB_DVORAK,  KB_US,  pckbd_keydesc_us_dvorak),
+   KBD_MAP(KB_US | KB_COLEMAK, KB_US,  pckbd_keydesc_us_colemak),
KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, pckbd_keydesc_swapctrlcaps),
KBD_MAP(KB_US | KB_IOPENER, KB_US,  pckbd_keydesc_iopener),
KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, pckbd_keydesc_swapctrlcaps),
@@ -1139,6 +1161,8 @@ const struct wscons_keydesc pckbd_keydesctab[] =

Re: Add Colemak keyboard encoding

2018-11-20 Thread Aaron Bieber
On Fri, 16 Nov 2018 at 07:02:42 -0700, Aaron Bieber wrote:
> On Fri, 16 Nov 2018 at 06:55:09 -0700, Aaron Bieber wrote:
> > Hi,
> >
> > This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. I
> > have updated it to add the 'swapctrlcaps' bit and removed the xenocara diff.
> >
> > https://marc.info/?l=openbsd-bugs=124284599329729
> >
> > Not sure if this didn't land because it was sent to bugs@ or if there are 
> > other
> > reasons. Please cluestick me if you know!
> >
> > OK?
> >
>

Here is a much cleaner version of the diff which adds proper man
entries and only modifies the keys that are different from KB_US.

OK?

diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 45ad55d8765..0135c715bc0 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -162,6 +162,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DECLK
 .Pq us.declk
 English/US mapping for
@@ -180,7 +185,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
index af218fa0910..211516596dd 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -198,6 +198,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DVORAK
 .Pq us.dvorak
 English/US keyboard with
@@ -212,8 +217,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and
-KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index d10a909eece..8708ef96e11 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -597,6 +597,27 @@ static const keysym_t pckbd_keydesc_us_dvorak[] = {
 KC(53),KS_z,
 };

+static const keysym_t pckbd_keydesc_us_colemak[] = {
+/*  pos  command   normal  shifted */
+KC(18),KS_f,
+KC(19),KS_p,
+KC(20),KS_g,
+KC(21),KS_j,
+KC(22),KS_l,
+KC(23),KS_u,
+KC(24),KS_y,
+KC(25),KS_semicolon,   KS_colon,
+KC(31),KS_r,
+KC(32),KS_s,
+KC(33),KS_t,
+KC(34),KS_d,
+KC(36),KS_n,
+KC(37),KS_e,
+KC(38),KS_i,   KS_I,
+KC(39),KS_o,
+KC(49),KS_k,
+};
+
 static const keysym_t pckbd_keydesc_swapctrlcaps[] = {
 /*  pos  command   normal  shifted */
 KC(29),KS_Caps_Lock,
@@ -1129,6 +1150,7 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
KBD_MAP(KB_NO | KB_NODEAD,  KB_NO,  pckbd_keydesc_no_nodead),
KBD_MAP(KB_US | KB_DECLK,   KB_US,  pckbd_keydesc_us_declk),
KBD_MAP(KB_US | KB_DVORAK,  KB_US,  pckbd_keydesc_us_dvorak),
+   KBD_MAP(KB_US | KB_COLEMAK, KB_US,  pckbd_keydesc_us_colemak),
KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, pckbd_keydesc_swapctrlcaps),
KBD_MAP(KB_US | KB_IOPENER, KB_US,  pckbd_keydesc_iopener),
KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, pckbd_keydesc_swapctrlcaps),
@@ -1139,6 +1161,8 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
KBD_MAP(KB_BE | KB_SWAPCTRLCAPS, KB_BE, pckbd_keydesc_swapctrlcaps),
KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS,KB_US | KB_DVORAK,
pckbd_keydesc_swapctrlcaps),
+   KBD_MAP(KB_US | KB_COLEMAK | KB_SWAPCTRLCAPS,   KB_US | KB_COLEMAK,
+   pckbd_keydesc_swapctrlcaps),
KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,   KB_US | KB_IOPENER,
pckbd_keydesc_swapctrlcaps),
KBD_MAP(KB_ES,  KB_US,  pckbd_keydesc_es),
diff --git a/sys/dev/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c
index 3cf1dfe18ed..3048f468b85 100644
--- a/sys/dev/usb/ukbdmap.c
+++ b/sys/dev/usb/ukbdmap.c
@@ -626,6 +626,27 @@ static const keysym_t ukbd_keydesc_us_dvorak[] = {
 KC(56),K

Re: Add Colemak keyboard encoding

2018-11-16 Thread Aaron Bieber
On Fri, 16 Nov 2018 at 06:55:09 -0700, Aaron Bieber wrote:
> Hi,
> 
> This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. I
> have updated it to add the 'swapctrlcaps' bit and removed the xenocara diff.
> 
> https://marc.info/?l=openbsd-bugs=124284599329729
> 
> Not sure if this didn't land because it was sent to bugs@ or if there are 
> other
> reasons. Please cluestick me if you know!
> 
> OK?
> 

Forgot the man bits:

diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 45ad55d8765..858fd5f8580 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -162,6 +162,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DECLK
 .Pq us.declk
 English/US mapping for
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
index af218fa0910..94080a6c674 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -198,6 +198,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DVORAK
 .Pq us.dvorak
 English/US keyboard with

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Add Colemak keyboard encoding

2018-11-16 Thread Aaron Bieber
Hi,

This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. I
have updated it to add the 'swapctrlcaps' bit and removed the xenocara diff.

https://marc.info/?l=openbsd-bugs=124284599329729

Not sure if this didn't land because it was sent to bugs@ or if there are other
reasons. Please cluestick me if you know!

OK?

diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index d10a909eece..bb513824042 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -597,6 +597,61 @@ static const keysym_t pckbd_keydesc_us_dvorak[] = {
 KC(53),KS_z,
 };
 
+static const keysym_t pckbd_keydesc_us_colemak[] = {
+/*  pos  command   normal  shifted */
+KC(41),KS_grave,   KS_asciitilde,  KS_dead_tilde,  
KS_asciitilde,
+KC(2), KS_1,   KS_exclam,  KS_exclamdown,  
KS_onesuperior,
+KC(3), KS_2,   KS_at,  KS_masculine,   
KS_twosuperior,
+KC(4), KS_3,   KS_numbersign,  KS_ordfeminine, 
KS_threesuperior,
+KC(5), KS_4,   KS_dollar,  KS_cent,
KS_sterling,
+KC(6), KS_5,   KS_percent, KS_asciitilde,  
KS_yen,
+KC(7), KS_6,   KS_asciicircum, KS_asciitilde,  
KS_asciitilde,
+KC(8), KS_7,   KS_ampersand,   KS_eth, 
KS_ETH,
+KC(9), KS_8,   KS_asterisk,KS_thorn,   
KS_THORN,
+KC(10),KS_9,   KS_parenleft,   KS_asciitilde,  
KS_asciitilde,
+KC(11),KS_0,   KS_parenright,  KS_asciitilde,  
KS_asciitilde,
+KC(12),KS_minus,   KS_underscore,  KS_asciitilde,  
KS_asciitilde,
+KC(13),KS_equal,   KS_plus,KS_multiply,
KS_division,
+KC(16),KS_q,   KS_Q,   KS_adiaeresis,  
KS_Adiaeresis,
+KC(17),KS_w,   KS_W,   KS_aring,   
KS_Aring,
+KC(18),KS_f,   KS_F,   KS_atilde,  
KS_Atilde,
+KC(19),KS_p,   KS_P,   KS_oslash,  
KS_Ooblique,
+KC(20),KS_g,   KS_G,   KS_asciitilde,  
KS_asciitilde,
+KC(21),KS_j,   KS_J,   KS_asciitilde,  
KS_asciitilde,
+KC(22),KS_l,   KS_L,   KS_asciitilde,  
KS_asciitilde,
+KC(23),KS_u,   KS_U,   KS_uacute,  
KS_Uacute,
+KC(24),KS_y,   KS_Y,   KS_udiaeresis,  
KS_Udiaeresis,
+KC(25),KS_semicolon,   KS_colon,   KS_odiaeresis,  
KS_Odiaeresis,
+KC(26),KS_bracketleft, KS_braceleft,   
KS_guillemotleft, KS_asciitilde,
+KC(27),KS_bracketright, KS_braceright, 
KS_guillemotright, KS_asciitilde,
+KC(43),KS_backslash,   KS_bar, KS_asciitilde,  
KS_asciitilde,
+KC(30),KS_a,   KS_A,   KS_aacute,  
KS_Aacute,
+KC(31),KS_r,   KS_R,   KS_dead_grave,  
KS_asciitilde,
+KC(32),KS_s,   KS_S,   KS_ssharp,  
KS_asciitilde,
+KC(33),KS_t,   KS_T,   KS_dead_acute,  
KS_asciitilde,
+KC(34),KS_d,   KS_D,   
KS_dead_diaeresis, KS_asciitilde,
+KC(35),KS_h,   KS_H,   KS_asciitilde,  
KS_asciitilde,
+KC(36),KS_n,   KS_N,   KS_ntilde,  
KS_Ntilde,
+KC(37),KS_e,   KS_E,   KS_eacute,  
KS_Eacute,
+KC(38),KS_i,   KS_I,   KS_iacute,  
KS_Iacute,
+KC(39),KS_o,   KS_O,   KS_oacute,  
KS_Oacute,
+KC(40),KS_apostrophe,  KS_quotedbl,KS_otilde,  
KS_Otilde,
+KC(44),KS_z,   KS_Z,   KS_ae,  
KS_AE,
+KC(45),KS_x,   KS_X,   
KS_dead_circumflex, KS_asciitilde,
+KC(46),KS_c,   KS_C,   KS_ccedilla,
KS_Ccedilla,
+KC(47),KS_v,   KS_V,   KS_asciitilde,  
KS_asciitilde,
+KC(48),KS_b,   KS_B,   KS_asciitilde,  
KS_asciitilde,
+KC(49),KS_k,   KS_K,   KS_asciitilde,  
KS_asciitilde,
+KC(50),KS_m,   KS_M,   KS_asciitilde,  
KS_asciitilde,
+KC(51),KS_comma,   KS_less,

Add the ability to style inactive panes in tmux

2018-09-30 Thread Aaron Bieber
Hi!

This diff lets one style the inactive panes in tmux without forcing a default
style.

Before this diff I was using a combo of 'window-style' and
'window-active-style' to mimic this feature. This method isn't ideal because
window-active-style becomes the "default", while window-style is the
"inactive" style. This is confusing and also "bypasses" the colors defined in
the terminal being used (adding another layer of confusion!).

I have been running it on a few machines without issue.

OK? Clue sticks?

diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index f3622017830..97b21f01e58 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -254,6 +254,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item 
*item)
if (strcmp(name, "monitor-silence") == 0)
alerts_reset_all();
if (strcmp(name, "window-style") == 0 ||
+   strcmp(name, "window-inactive-style") == 0 ||
strcmp(name, "window-active-style") == 0) {
RB_FOREACH(w, windows, )
w->flags |= WINDOW_STYLECHANGED;
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index b8ca7f1c8b6..a8171d3de8b 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -771,6 +771,12 @@ const struct options_table_entry options_table[] = {
  .default_str = "default"
},
 
+   { .name = "window-inactive-style",
+ .type = OPTIONS_TABLE_STYLE,
+ .scope = OPTIONS_TABLE_WINDOW,
+ .default_str = "default"
+   },
+
{ .name = "window-style",
  .type = OPTIONS_TABLE_STYLE,
  .scope = OPTIONS_TABLE_WINDOW,
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index eca8e2afeec..12487d8d637 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -2026,9 +2026,10 @@ and
 .Ic swap-window .
 .Pp
 Each pane has a style: by default the
-.Ic window-style
-and
+.Ic window-style ,
 .Ic window-active-style
+and
+.Ic window-inactive-style
 options are used,
 .Ic select-pane
 .Fl P
@@ -3251,6 +3252,14 @@ see the
 .Ic message-command-style
 option.
 .Pp
+.It Ic window-inactive-style Ar style
+Set the style for the window's inactive panes.
+For how to specify
+.Ar style ,
+see the
+.Ic message-command-style
+option.
+.Pp
 .It Ic window-status-activity-style Ar style
 Set status line style for windows with an activity alert.
 For how to specify
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 3c348b1fb29..75e2cae6c5a 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -808,6 +808,7 @@ struct window {
 
struct grid_cell style;
struct grid_cell active_style;
+   struct grid_cell inactive_style;
 
u_intreferences;
TAILQ_HEAD(, winlink) winlinks;
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 754614b27de..80bb9f6307c 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -2146,17 +2146,20 @@ tty_default_colours(struct grid_cell *gc, const struct 
window_pane *wp)
 {
struct window   *w = wp->window;
struct options  *oo = w->options;
-   const struct grid_cell  *agc, *pgc, *wgc;
+   const struct grid_cell  *agc, *igc, *pgc, *wgc;
int  c;
 
if (w->flags & WINDOW_STYLECHANGED) {
w->flags &= ~WINDOW_STYLECHANGED;
agc = options_get_style(oo, "window-active-style");
memcpy(>active_style, agc, sizeof w->active_style);
+   igc = options_get_style(oo, "window-inactive-style");
+   memcpy(>inactive_style, igc, sizeof w->inactive_style);
wgc = options_get_style(oo, "window-style");
memcpy(>style, wgc, sizeof w->style);
} else {
agc = >active_style;
+   igc = >inactive_style;
wgc = >style;
}
pgc = >colgc;
@@ -2166,6 +2169,8 @@ tty_default_colours(struct grid_cell *gc, const struct 
window_pane *wp)
gc->fg = pgc->fg;
else if (wp == w->active && agc->fg != 8)
gc->fg = agc->fg;
+   else if (wp != w->active && igc->fg != 8)
+   gc->fg = igc->fg;
else
gc->fg = wgc->fg;
 
@@ -2179,6 +2184,8 @@ tty_default_colours(struct grid_cell *gc, const struct 
window_pane *wp)
gc->bg = pgc->bg;
else if (wp == w->active && agc->bg != 8)
gc->bg = agc->bg;
+   else if (wp != w->active && igc->bg != 8)
+   gc->bg = igc->bg;
else
gc->bg = wgc->bg;
 
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index f94724fdbf1..f0ec870a5fa 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -476,17 +476,19 @@ window_set_active_pane(struct window *w, struct 

Re: Allow disks to be specifid by duid in install.sub

2018-05-17 Thread Aaron Bieber
On Thu, May 17, 2018 at 06:37:56PM -0600, Aaron Bieber wrote:
> On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> > Hi,
> > 
> > Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> > "Which disk is the root disk?" prompt. This is great for humans, but
> > things get tricky when doing an autoinstall upgrade on systems where
> > connected disks change frequently.
> > 
> > This diff lets you put the DUID in the response file.
> > 
> > If anyone has a better way to determine the disk from the duid, I am all
> > ears :D
> > 
> > Cheers,
> > Aaron
> > 
> 
> Thanks to tb@, kn@, Philipp Buehler and phy1729 on #metabug! I tested a
> bsd.rd with an auto-upgrade response file. Once with a duid and once
> with a disk name. Both worked.
> 
> I have an OK from tb@ unless anyone objects.
> 
> The diff has been distilled down to this:
> 

Paste fail, here is the latest diff:

Index: distrib/miniroot/install.sub
===
RCS file: /var/cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1067
diff -u -p -r1.1067 install.sub
--- distrib/miniroot/install.sub7 May 2018 10:44:01 -   1.1067
+++ distrib/miniroot/install.sub18 May 2018 00:16:34 -
@@ -336,6 +336,12 @@ get_ifs() {
done
 }
 
+# checks whether $1 is a valid duid
+is_duid() {
+   ((${#1} == 16)) && [[ $1 == +([0-9a-f]) ]] && return 0
+   return 1
+}
+
 # Return the device name of the disk device $1, which may be a disklabel UID.
 get_dkdev_name() {
local _dev=${1#/dev/} _d
@@ -2231,7 +2237,8 @@ get_rootinfo() {
case $resp in
"?")diskinfo $(get_dkdevs);;
'') ;;
-   *)  if isin "$resp" $(get_dkdevs); then
+   *)  $AUTO && is_duid "$resp" && resp=$(get_dkdev_name $resp)
+   if isin "$resp" $(get_dkdevs); then
[[ $MODE == install ]] && break
is_rootdisk "$resp" && break
echo "$resp is not a valid root disk."

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: Allow disks to be specifid by duid in install.sub

2018-05-17 Thread Aaron Bieber
On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> Hi,
> 
> Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> "Which disk is the root disk?" prompt. This is great for humans, but
> things get tricky when doing an autoinstall upgrade on systems where
> connected disks change frequently.
> 
> This diff lets you put the DUID in the response file.
> 
> If anyone has a better way to determine the disk from the duid, I am all
> ears :D
> 
> Cheers,
> Aaron
> 

Thanks to tb@, kn@, Philipp Buehler and phy1729 on #metabug! I tested a
bsd.rd with an auto-upgrade response file. Once with a duid and once
with a disk name. Both worked.

I have an OK from tb@ unless anyone objects.

The diff has been distilled down to this:

Index: distrib/miniroot/install.sub
===
RCS file: /var/cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1067
diff -u -p -r1.1067 install.sub
--- distrib/miniroot/install.sub7 May 2018 10:44:01 -   1.1067
+++ distrib/miniroot/install.sub16 May 2018 21:13:15 -
@@ -336,6 +336,12 @@ get_ifs() {
done
 }
 
+# checks whether $1 is a valid duid
+is_duid() {
+   ((${#1} == 16)) && [[ $1 = +(0-9a-f) ]] && return 0
+   return 1
+}
+
 # Return the device name of the disk device $1, which may be a disklabel UID.
 get_dkdev_name() {
local _dev=${1#/dev/} _d
@@ -2231,7 +2237,8 @@ get_rootinfo() {
case $resp in
"?")diskinfo $(get_dkdevs);;
'') ;;
-   *)  if isin "$resp" $(get_dkdevs); then
+   *)  $AUTO && is_duid "$resp" && resp=$(get_dkdev_name $resp)
+   if isin "$resp" $(get_dkdevs); then
[[ $MODE == install ]] && break
is_rootdisk "$resp" && break
echo "$resp is not a valid root disk."

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: Allow disks to be specifid by duid in install.sub

2018-03-02 Thread Aaron Bieber
On Fri, Mar 02, 2018 at 03:21:00PM -0700, Aaron Bieber wrote:
> On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> > Hi,
> >
> > Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> > "Which disk is the root disk?" prompt. This is great for humans, but
> > things get tricky when doing an autoinstall upgrade on systems where
> > connected disks change frequently.
> >
> > This diff lets you put the DUID in the response file.
> >
> > If anyone has a better way to determine the disk from the duid, I am all
> > ears :D
> >
> > Cheers,
> > Aaron
> >
>
> New version uses hw.disknames vs the ghetto diskutil | grep check.
>
> Thanks to Philipp Buehler for proper cluesticking :D
>

Few more tweaks (thanks to phy1729 on #metabug):
 - don't loop over the info passed to bsort
 - stop looping if we find our duid -> disk mapping

Index: distrib/miniroot/install.sub
===
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1065
diff -u -p -r1.1065 install.sub
--- distrib/miniroot/install.sub21 Feb 2018 20:02:37 -  1.1065
+++ distrib/miniroot/install.sub2 Mar 2018 23:48:23 -
@@ -306,6 +306,13 @@ scan_disknames() {
bsort $(for _n in $_disks; do echo "${_n%%:*} "; done | sed -n "$1")
 }

+# Return disk devices along with their uids.
+scan_disks() {
+   local IFS=, _disks=$(sysctl -n hw.disknames)
+
+   bsort $_disks
+}
+
 # Return disk devices found in hw.disknames.
 get_dkdevs() {
echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
@@ -2201,6 +2208,23 @@ set_timezone() {
done
 }

+# Determine the disk name from supplied disk uid.
+duid_to_disk() {
+   local _in=$1 _disk
+   local _disks=$(scan_disks)
+
+   for _d in ${_disks}; do
+   local _a=${_d##*:}
+   local _b=${_d%%:*}
+   if [[ $_in == ${_a} ]]; then
+   echo $_b
+   return
+   fi
+   done
+
+   echo $_in
+}
+
 # Determine if the supplied disk is a potential root disk, by:
 # - Check the disklabel if there is an 'a' partition of type 4.2BSD
 # - Mount the partition (read-only) and look for typical root filesystem layout
@@ -2231,7 +2255,8 @@ get_rootinfo() {
case $resp in
"?")diskinfo $(get_dkdevs);;
'') ;;
-   *)  if isin "$resp" $(get_dkdevs); then
+   *)  resp=$(duid_to_disk "$resp")
+   if isin "$resp" $(get_dkdevs); then
[[ $MODE == install ]] && break
is_rootdisk "$resp" && break
echo "$resp is not a valid root disk."

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: Allow disks to be specifid by duid in install.sub

2018-03-02 Thread Aaron Bieber
On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> Hi,
>
> Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> "Which disk is the root disk?" prompt. This is great for humans, but
> things get tricky when doing an autoinstall upgrade on systems where
> connected disks change frequently.
>
> This diff lets you put the DUID in the response file.
>
> If anyone has a better way to determine the disk from the duid, I am all
> ears :D
>
> Cheers,
> Aaron
>

New version uses hw.disknames vs the ghetto diskutil | grep check.

Thanks to Philipp Buehler for proper cluesticking :D

Index: distrib/miniroot/install.sub
===
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1065
diff -u -p -r1.1065 install.sub
--- distrib/miniroot/install.sub21 Feb 2018 20:02:37 -  1.1065
+++ distrib/miniroot/install.sub2 Mar 2018 17:25:39 -
@@ -306,6 +306,13 @@ scan_disknames() {
bsort $(for _n in $_disks; do echo "${_n%%:*} "; done | sed -n "$1")
 }

+# Return disk devices along with their uids.
+scan_disks() {
+   local IFS=, _disks=$(sysctl -n hw.disknames)
+
+   bsort $(for _n in $_disks; do echo "${_n}"; done)
+}
+
 # Return disk devices found in hw.disknames.
 get_dkdevs() {
echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
@@ -2201,6 +2208,26 @@ set_timezone() {
done
 }

+# Determine the disk name from supplied disk uid.
+duid_to_disk() {
+   local _in=$1 _disk
+   local _disks=$(scan_disks)
+
+   for _d in ${_disks}; do
+   local _a=${_d##*:}
+   local _b=${_d%%:*}
+   if [[ $_in == ${_a} ]]; then
+   _disk=$_b
+   fi
+   done
+
+   if [[ -z $_disk ]]; then
+   echo $_in
+   else
+   echo $_disk
+   fi
+}
+
 # Determine if the supplied disk is a potential root disk, by:
 # - Check the disklabel if there is an 'a' partition of type 4.2BSD
 # - Mount the partition (read-only) and look for typical root filesystem layout
@@ -2231,7 +2258,8 @@ get_rootinfo() {
case $resp in
"?")diskinfo $(get_dkdevs);;
'') ;;
-   *)  if isin "$resp" $(get_dkdevs); then
+   *)  resp=$(duid_to_disk "$resp")
+   if isin "$resp" $(get_dkdevs); then
[[ $MODE == install ]] && break
is_rootdisk "$resp" && break
echo "$resp is not a valid root disk."

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Allow disks to be specifid by duid in install.sub

2018-03-02 Thread Aaron Bieber
Hi,

Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
"Which disk is the root disk?" prompt. This is great for humans, but
things get tricky when doing an autoinstall upgrade on systems where
connected disks change frequently.

This diff lets you put the DUID in the response file.

If anyone has a better way to determine the disk from the duid, I am all
ears :D

Cheers,
Aaron

Index: distrib/miniroot/install.sub
===
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1065
diff -u -p -r1.1065 install.sub
--- distrib/miniroot/install.sub21 Feb 2018 20:02:37 -  1.1065
+++ distrib/miniroot/install.sub2 Mar 2018 14:03:45 -
@@ -2201,6 +2201,24 @@ set_timezone() {
done
 }

+# Determine the disk name from supplied disk uid.
+# - If our supplied value doesn't match the uid RE,
+#   assume it is a disk.
+duid_to_disk() {
+   local _in=$1 _tdisk _disk
+
+   echo "$_in" | sed -n '/^[a-f0-9]\{16\}/p' | grep -q "$_in"
+   if (($? == 0)); then
+   _tdisk=$(disklabel "$_in" | grep "^# /dev")
+   _tdisk=${_tdisk##* /dev/r}
+   _disk=${_tdisk%%c:*}
+
+   echo $_disk
+   else
+   echo $_in
+   fi
+}
+
 # Determine if the supplied disk is a potential root disk, by:
 # - Check the disklabel if there is an 'a' partition of type 4.2BSD
 # - Mount the partition (read-only) and look for typical root filesystem layout
@@ -2231,7 +2249,8 @@ get_rootinfo() {
case $resp in
"?")diskinfo $(get_dkdevs);;
'') ;;
-   *)  if isin "$resp" $(get_dkdevs); then
+   *)  resp=$(duid_to_disk "$resp")
+   if isin "$resp" $(get_dkdevs); then
[[ $MODE == install ]] && break
is_rootdisk "$resp" && break
echo "$resp is not a valid root disk."

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



rc.d/vmd - wait for vms to shutdown

2018-02-16 Thread Aaron Bieber
Hola,

Here is a stab at telling /etc/rc.d/vmd to wait for vms to shutdown
before killing vmd.

Since there is no linux vmmci layer - linux machines still get killed.

#!/bin/ksh
#
# $OpenBSD: vmd,v 1.6 2018/01/11 22:44:44 rpe Exp $

daemon="/usr/sbin/vmd"

. /etc/rc.d/rc.subr

# Child will not return a config parsing error to the parent.
rc_pre() {
${daemon} -n ${daemon_flags}
}

list_running() {
echo $(vmctl status | awk '$2 ~ "[0-9]" {print $NF}')
}

rc_stop() {
num_running=0
for vm in $(list_running); do
vmctl stop "$vm"
((num_running=num_running+1))
done

while [ $num_running -gt 0 ]; do
c=0
for vm in $(list_running); do
((c=c+1))
done

if [ $c = 0 ]; then
num_running=0
fi
done

pkill -T "${daemon_rtable}" -xf "${pexp}"
}

rc_cmd $1

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



permit IPV6_V6ONLY in sockopt()

2017-11-17 Thread Aaron Bieber
Hi,

I ran into a pledge'ing weirdness with Go apps and 'inet'. Go tries to
probe available communication options:

https://github.com/golang/go/blob/master/src/net/ipsock_posix.go#L44-L56

The result of which ends up being 'inet' pledged go apps fail with:
'pledge "inet", syscall 105'

Removing the "#ifdef notyet"'d IPV6_V6ONLY fixes this issue for me.

Discussed with tb, jca and deraadt. OK?

Cheers,
Aaron

Index: kern/kern_pledge.c
===
RCS file: /cvs/src/sys/kern/kern_pledge.c,v
retrieving revision 1.223
diff -u -p -r1.223 kern_pledge.c
--- kern/kern_pledge.c  12 Oct 2017 15:04:33 -  1.223
+++ kern/kern_pledge.c  17 Nov 2017 22:29:54 -
@@ -1280,9 +1280,7 @@ pledge_sockopt(struct proc *p, int set,
case IPV6_PORTRANGE:
case IPV6_RECVPKTINFO:
case IPV6_RECVDSTPORT:
-#ifdef notyet
case IPV6_V6ONLY:
-#endif
return (0);
case IPV6_MULTICAST_IF:
case IPV6_MULTICAST_HOPS:

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: Please test: kqueue & rwlock

2017-09-29 Thread Aaron Bieber
On Thu, Sep 28, 2017 at 02:07:39PM +, Martin Pieuchot wrote:
> On 12/09/17(Tue) 11:09, Martin Pieuchot wrote:
> > My previous attempt to grab the NET_LOCK(), thus potentially sleeping,
> > inside kqueue_scan() resulting in NULL dereferences:
> > https://marc.info/?l=openbsd-bugs=149935139022501=2
> > 
> > The problem is that the loop isn't ready to be consulted by multiple
> > threads at the same time.  By "at the same time", I mean that when a
> > thread sleeps it can be consulted by another one.
> > 
> > The diff below addresses that by correcting kqueue's refcount and by
> > using a per-threada marker.  I took this idea from Dragonfly because
> > I believe that we can extend it to make kevent(2) MPSAFE later.
> > 
> > Diff below also includes socket filter modifications grabbing the
> > NET_LOCK() as well.  juanfra@ told me he couldn't reproduce the
> > previous crash with this diff, however I'm looking for more testers.
> 
> Here's an updated version that fixes a hang triggered by lldpd(8)
> reported by sthen@.
> 
> Juan-Fra, Aaron does this version still work for you?

No issues so far!

> 
> Comments?
> 
> Index: kern/kern_event.c
> ===
> RCS file: /cvs/src/sys/kern/kern_event.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 kern_event.c
> --- kern/kern_event.c 31 May 2017 14:52:05 -  1.79
> +++ kern/kern_event.c 28 Sep 2017 14:01:46 -
> @@ -476,6 +476,7 @@ sys_kevent(struct proc *p, void *v, regi
>   struct file *fp;
>   struct timespec ts;
>   int i, n, nerrors, error;
> + struct kevent kev[KQ_NEVENTS];
>  
>   if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL ||
>   (fp->f_type != DTYPE_KQUEUE))
> @@ -500,16 +501,16 @@ sys_kevent(struct proc *p, void *v, regi
>   while (SCARG(uap, nchanges) > 0) {
>   n = SCARG(uap, nchanges) > KQ_NEVENTS ?
>   KQ_NEVENTS : SCARG(uap, nchanges);
> - error = copyin(SCARG(uap, changelist), kq->kq_kev,
> + error = copyin(SCARG(uap, changelist), kev,
>   n * sizeof(struct kevent));
>   if (error)
>   goto done;
>  #ifdef KTRACE
>   if (KTRPOINT(p, KTR_STRUCT))
> - ktrevent(p, kq->kq_kev, n);
> + ktrevent(p, kev, n);
>  #endif
>   for (i = 0; i < n; i++) {
> - kevp = >kq_kev[i];
> + kevp = [i];
>   kevp->flags &= ~EV_SYSFLAGS;
>   error = kqueue_register(kq, kevp, p);
>   if (error || (kevp->flags & EV_RECEIPT)) {
> @@ -691,6 +692,7 @@ kqueue_scan(struct kqueue *kq, int maxev
>   struct timeval atv, rtv, ttv;
>   struct knote *kn, marker;
>   int s, count, timeout, nkev = 0, error = 0;
> + struct kevent kev[KQ_NEVENTS];
>  
>   count = maxevents;
>   if (count == 0)
> @@ -737,7 +739,7 @@ start:
>   goto done;
>   }
>  
> - kevp = kq->kq_kev;
> + kevp = [0];
>   s = splhigh();
>   if (kq->kq_count == 0) {
>   if (timeout < 0) {
> @@ -757,25 +759,35 @@ start:
>   goto done;
>   }
>  
> + marker.kn_filter = EVFILT_MARKER;
>   TAILQ_INSERT_TAIL(>kq_head, , kn_tqe);
>   while (count) {
>   kn = TAILQ_FIRST(>kq_head);
> - TAILQ_REMOVE(>kq_head, kn, kn_tqe);
>   if (kn == ) {
> + TAILQ_REMOVE(>kq_head, , kn_tqe);
>   splx(s);
>   if (count == maxevents)
>   goto retry;
>   goto done;
>   }
> + if (kn->kn_filter == EVFILT_MARKER) {
> + struct knote *other_marker = kn;
> +
> + /* Move some other threads marker past this kn */
> + kn = TAILQ_NEXT(other_marker, kn_tqe);
> + TAILQ_REMOVE(>kq_head, kn, kn_tqe);
> + TAILQ_INSERT_BEFORE(other_marker, kn, kn_tqe);
> + continue;
> + }
> + TAILQ_REMOVE(>kq_head, kn, kn_tqe);
> + kq->kq_count--;
>   if (kn->kn_status & KN_DISABLED) {
>   kn->kn_status &= ~KN_QUEUED;
> - kq->kq_count--;
>   continue;
>   }
>   if ((kn->kn_flags & EV_ONESHOT) == 0 &&
>   kn->kn_fop->f_event(kn, 0) == 0) {
>   kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE);
> - kq->kq_count--;
>   continue;
>   }
>   *kevp = kn->kn_kevent;
> @@ -783,7 +795,6 @@ start:
>   nkev++;
>   if (kn->kn_flags & EV_ONESHOT) {
>   kn->kn_status &= ~KN_QUEUED;
> - kq->kq_count--;
>   splx(s);
>   

Re: combined usb rng driver

2017-08-27 Thread Aaron Bieber
 00:00:00 -
> +++ share/man/man4/urng.4 26 Aug 2017 20:34:54 -
> @@ -0,0 +1,63 @@
> +.\"  $OpenBSD$
> +.\"
> +.\" Copyright (c) 2015 Sean Levy <att...@stalphonsos.com>
> +.\" Copyright (c) 2017 Jasper Lievisse Adriaanse <jas...@openbsd.org>
> +.\"
> +.\" Permission to use, copy, modify, and distribute this software for any
> +.\" purpose with or without fee is hereby granted, provided that the above
> +.\" copyright notice and this permission notice appear in all copies.
> +.\"
> +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> +.\"
> +.Dd $Mdocdate$
> +.Dt URNG 4
> +.Os
> +.Sh NAME
> +.Nm urng
> +.Nd USB Random Number Generator devices
> +.Sh SYNOPSIS
> +.Cd "urng* at uhub?"
> +.Sh DESCRIPTION
> +The
> +.Nm
> +driver provides support for various true random number generator
> +(TRNG) devices connected via USB.
> +.Nm
> +reads raw entropy from the device at a (hardware dependent) interval
> +and stirs it into the system entropy pool with
> +.Xr add_true_randomness 9 .
> +.Sh HARDWARE
> +The following devices are supported by this driver:
> +.Pp
> +.Bl -tag -width "Altusmetrum"
> +.It Araneus Alea II
> +Capable of delivering 100kbit/sec of hardware-generated entropy.
> +The product documentation states that the USB interface used by the
> +Alea II is the same as that used by its predecessor the Alea I;
> +theoretically this means that the Alea I should work but this has not
> +been tested.
> +.It Altusmetrum ChaosKey 1.0
> +This device is capable of providing entropy at 10Mbit/s.
> +.El
> +.Sh SEE ALSO
> +.Xr intro 4 ,
> +.Xr usb 4 ,
> +.Xr add_true_randomness 9
> +.Sh HISTORY
> +The
> +.Nm
> +driver first appeared in
> +.Ox 6.2 .
> +.Sh AUTHORS
> +The
> +.Nm
> +driver was written by
> +.An Aaron Bieber Aq Mt abie...@openbsd.org ,
> +.An Jasper Lievisse Adriaanse Aq Mt jas...@openbsd.org ,
> +.An Sean Levy Aq Mt att...@stalphonsos.com .
> Index: share/man/man4/usb.4
> ===
> RCS file: /cvs/src/share/man/man4/usb.4,v
> retrieving revision 1.183
> diff -u -p -r1.183 usb.4
> --- share/man/man4/usb.4  22 Mar 2017 06:09:31 -  1.183
> +++ share/man/man4/usb.4  26 Aug 2017 20:10:25 -
> @@ -288,8 +288,6 @@ USB Mobile Broadband Interface Model (MB
>  .El
>  .Ss Miscellaneous devices
>  .Bl -tag -width 12n -offset ind -compact
> -.It Xr ualea 4
> -Araneus Alea II USB TRNG
>  .It Xr uberry 4
>  Research In Motion BlackBerry
>  .It Xr ugen 4
> @@ -304,6 +302,8 @@ Moonbase Otago OneRNG TRNG
>  Maxim/Dallas DS2490 USB 1-Wire adapter
>  .It Xr upl 4
>  Prolific based host-to-host adapters
> +.It Xr urng 4
> +USB Random Number Generator devices
>  .It Xr usps 4
>  USPS composite AC power and temperature sensor
>  .It Xr uts 4
> Index: sys/arch/alpha/conf/GENERIC
> ===
> RCS file: /cvs/src/sys/arch/alpha/conf/GENERIC,v
> retrieving revision 1.259
> diff -u -p -r1.259 GENERIC
> --- sys/arch/alpha/conf/GENERIC   31 Aug 2016 12:46:45 -  1.259
> +++ sys/arch/alpha/conf/GENERIC   26 Aug 2017 19:43:23 -
> @@ -62,7 +62,7 @@ usb*at ohci?
>  # USB devices
>  uhub*at usb? # USB Hubs
>  uhub*at uhub?# USB Hubs
> -ualea*   at uhub?# Araneus Alea II TRNG
> +urng*at uhub?# USB Random Number Generator
>  uonerng* at uhub?# Moonbase Otago OneRNG
>  umodem*  at uhub?# USB Modems/Serial
>  ucom*at umodem?
> Index: sys/arch/amd64/conf/GENERIC
> ===
> RCS file: /cvs/src/sys/arch/amd64/conf/GENERIC,v
> retrieving revision 1.444
> diff -u -p -r1.444 GENERIC
> --- sys/arch/amd64/conf/GENERIC   14 Jun 2017 22:35:43 -  1.444
> +++ sys/arch/amd64/conf/GENERIC   26 Aug 2017 19:43:21 -
> @@ -204,8 +204,9 @@ usb*  at ohci?
>  # USB devices
>  uhub*at usb? 

Prevent pkg_info from puking: 'Use of uninitialized'

2017-08-05 Thread Aaron Bieber
Hola,

This was spotted by mischief on #openbsd (freenode). Currently if -v
is used with -Q and PKG_PATH is not set, users see:

  Use of uninitialized value $ENV{"PKG_PATH"} in concatenation (.) or
  string at /usr/libdata/perl5/OpenBSD/PkgInfo.pm line...

This diff fixes that.

OK?

Cheers,
Aaron

Index: OpenBSD/PkgInfo.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
retrieving revision 1.46
diff -u -p -r1.46 PkgInfo.pm
--- OpenBSD/PkgInfo.pm  4 Aug 2017 23:35:40 -   1.46
+++ OpenBSD/PkgInfo.pm  6 Aug 2017 03:31:38 -
@@ -596,7 +596,8 @@ sub parse_and_run
if ($state->opt('Q')) {
require OpenBSD::Search;
 
-   print "PKG_PATH=$ENV{PKG_PATH}\n" if $state->verbose;
+   print "PKG_PATH=$ENV{PKG_PATH}\n" if ($state->verbose &&
+   defined $ENV{PKG_PATH});
my $partial = 
OpenBSD::Search::PartialStem->new($state->opt('Q'));
my $r = $state->repo->match_locations($partial);
 


-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: make pkg_info -Q work with other flags

2017-08-02 Thread Aaron Bieber
On Sat, Jul 29, 2017 at 10:40:37AM -0600, Aaron Bieber wrote:
> Hola,
> 
> Currently "pkg_info -Q" doesn't respect other flags and the way
> pkg_info(1) reads, it implies that they will work with it.
> 
> This diff makes pkg_info function as expected when other flags are
> passed when using -Q.

Ping. Clue sticks? OKs?

> 
> Cheers,
> Aaron
> 
> Index: OpenBSD/PkgInfo.pm
> ===
> RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
> retrieving revision 1.44
> diff -u -p -r1.44 PkgInfo.pm
> --- OpenBSD/PkgInfo.pm25 Jan 2017 14:10:46 -  1.44
> +++ OpenBSD/PkgInfo.pm29 Jul 2017 16:32:54 -
> @@ -406,13 +406,18 @@ sub print_info
>   }
>   $state->say("#1", $compose);
>   } elsif ($state->opt('I')) {
> - if ($state->opt('q')) {
> - $state->say("#1", $pkg);
> + if ($state->opt('Q')) {
> + $state->say(
> + is_installed($pkg) ? "#1 (installed)" : "#1", $pkg);
>   } else {
> - my $l = 20 - length($pkg);
> - $l = 1 if $l <= 0;
> - $state->say("#1#2#3", $pkg, " "x$l,
> - get_comment($handle->info));
> + if ($state->opt('q')) {
> + $state->say("#1", $pkg);
> + } else {
> + my $l = 20 - length($pkg);
> + $l = 1 if $l <= 0;
> + $state->say("#1#2#3", $pkg, " "x$l,
> + get_comment($handle->info));
> + }
>   }
>   } else {
>   if ($state->opt('c')) {
> @@ -468,7 +473,7 @@ sub print_info
>   
> OpenBSD::x509::print_certificate_info($plist);
>   } elsif ($sig->{key} eq 'signify' ||
>   $sig->{key} eq 'signify2') {
> - $state->say("reportedly signed by #1", 
> + $state->say("reportedly signed by #1",
>   $plist->get('signer')->name);
>   }
>   } else {
> @@ -601,8 +606,10 @@ sub parse_and_run
>   my $r = $state->repo->match_locations($partial);
>  
>   for my $p (sort map {$_->name} @$r) {
> - $state->say(
> - is_installed($p) ? "#1 (installed)" : "#1", $p);
> + $self->find_pkg($state, $p,
> + sub {
> + $self->print_info($state, @_);
> + });
>   }
>  
>   return 0;
> 
> 
> -- 
> PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE
> 

-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



make pkg_info -Q work with other flags

2017-07-29 Thread Aaron Bieber
Hola,

Currently "pkg_info -Q" doesn't respect other flags and the way
pkg_info(1) reads, it implies that they will work with it.

This diff makes pkg_info function as expected when other flags are
passed when using -Q.

Cheers,
Aaron

Index: OpenBSD/PkgInfo.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
retrieving revision 1.44
diff -u -p -r1.44 PkgInfo.pm
--- OpenBSD/PkgInfo.pm  25 Jan 2017 14:10:46 -  1.44
+++ OpenBSD/PkgInfo.pm  29 Jul 2017 16:32:54 -
@@ -406,13 +406,18 @@ sub print_info
}
$state->say("#1", $compose);
} elsif ($state->opt('I')) {
-   if ($state->opt('q')) {
-   $state->say("#1", $pkg);
+   if ($state->opt('Q')) {
+   $state->say(
+   is_installed($pkg) ? "#1 (installed)" : "#1", $pkg);
} else {
-   my $l = 20 - length($pkg);
-   $l = 1 if $l <= 0;
-   $state->say("#1#2#3", $pkg, " "x$l,
-   get_comment($handle->info));
+   if ($state->opt('q')) {
+   $state->say("#1", $pkg);
+   } else {
+   my $l = 20 - length($pkg);
+   $l = 1 if $l <= 0;
+   $state->say("#1#2#3", $pkg, " "x$l,
+   get_comment($handle->info));
+   }
}
} else {
if ($state->opt('c')) {
@@ -468,7 +473,7 @@ sub print_info

OpenBSD::x509::print_certificate_info($plist);
} elsif ($sig->{key} eq 'signify' ||
$sig->{key} eq 'signify2') {
-   $state->say("reportedly signed by #1", 
+   $state->say("reportedly signed by #1",
$plist->get('signer')->name);
}
} else {
@@ -601,8 +606,10 @@ sub parse_and_run
my $r = $state->repo->match_locations($partial);
 
for my $p (sort map {$_->name} @$r) {
-   $state->say(
-   is_installed($p) ? "#1 (installed)" : "#1", $p);
+   $self->find_pkg($state, $p,
+   sub {
+   $self->print_info($state, @_);
+   });
}
 
return 0;


-- 
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE



Re: cpu{1,2,3}: failed to enter VMM mode

2016-10-15 Thread Aaron Bieber
On Sat, Oct 15, 2016 at 09:25:43AM -0600, Aaron Bieber wrote:
> Hola,
> 
> I have been running into some issues getting vmm to start up vms. It
> had been previously working (yes it's enabled in bios, I have even
> tried disabling and re-enabling a few times).
> 
> I started seeing the 'failed to enter VMM mode' about every other
> reboot but now it happens all the time.
> 
> Here is an example session:
>   doas vmd -dv
>  
>   startup
>   failed to open /etc/vm.conf: No such file or directory
> 
>   myvm: started vm 0 successfully, tty /dev/ttyp4
>   myvm: create vmm ioctl failed - exiting: Input/output error
> 
> vm was started with:
> 
>   doas vmctl start "myvm" -m 512M -i 1 -d disk.img -k /bsd
> 
> If anyone has any clue sticks, they would be much appreciated. Pending
> a firm beating, I am going to try a bios update.
> 
> and a dmesg:

Looks like the bios update fixed it! Sorry for the noise!



cpu{1,2,3}: failed to enter VMM mode

2016-10-15 Thread Aaron Bieber
Hola,

I have been running into some issues getting vmm to start up vms. It
had been previously working (yes it's enabled in bios, I have even
tried disabling and re-enabling a few times).

I started seeing the 'failed to enter VMM mode' about every other
reboot but now it happens all the time.

Here is an example session:
  doas vmd -dv
 
  startup
  failed to open /etc/vm.conf: No such file or directory

  myvm: started vm 0 successfully, tty /dev/ttyp4
  myvm: create vmm ioctl failed - exiting: Input/output error

vm was started with:

  doas vmctl start "myvm" -m 512M -i 1 -d disk.img -k /bsd

If anyone has any clue sticks, they would be much appreciated. Pending
a firm beating, I am going to try a bios update.

and a dmesg:

OpenBSD 6.0-current (obj) #0: Fri Oct 14 18:48:52 MDT 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP/obj
real mem = 8447725568 (8056MB)
avail mem = 8187170816 (7807MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xbcd3d000 (61 entries)
bios0: vendor LENOVO version "GIET75WW (2.25 )" date 06/24/2014
bios0: LENOVO 20ALCTO1WW
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP DBGP ECDT HPET APIC MCFG SSDT SSDT SSDT SSDT
SSDT SSDT SSDT SSDT PCCT SSDT TCPA UEFI MSDM ASF! BATB FPDT UEFI DMAR
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3) EHC1(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 798.28 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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,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 1 (application processor)
cpu1: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 798.16 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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,SENSOR,ARAT
cpu1: failed to identify
cpu1: 256KB 64b/line 8-way L2 cachecpu2 at mainbus0
: apid 2 (application processor)
cpu1: smt 1, core 0, package 0
cpu2: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 798.16 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,ITSCcpu2:
failed to identify
,FSGSBASE,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTMcpu3 at mainbus0,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
: apid 3 (application processor)
cpu2: smt 0, core 1, package 0
cpu3: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 798.16 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,ABMcpu3:
failed to identify
,PERF,ITSCioapic0 at
mainbus0,FSGSBASE,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM: apid 2 pa 
0xfec0,SENSOR,ARAT
, version 20, 40 pins
cpu3: 256KB 64b/line 8-way L2 cache
acpimcfg0 at acpi0cpu3: smt 1, core 1, package 0
 addr 0xf800, bus 0-63
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 2 (EXP1)
acpiprt3 at acpi0: bus 3 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
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: PUBS, resource for XHCI, EHC1
acpitz0 at acpi0: critical temperature is 200 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
"LEN0071" at acpi0 not configured
"LEN0035" at acpi0 not configured
"SMO1200" at acpi0 not configured
acpibat0 at acpi0: BAT0 model "45N" serial 13407 type LiP oem "SONY"
acpibat1 at acpi0: 

Re: Xorg stipple

2016-03-10 Thread Aaron Bieber

joshua stein writes:

> Is anyone seriously finding video/Xorg bugs through the default X
> stipple pattern anymore?  Xorg changed the default to draw a black
> background a while ago (with stipple enabled using the -retro flag),
> but we have this local change that reverted it while adding a silly
> -retard flag in order to show the black background.
>
> I think we can finally stop partying like it's 1989 (vax is dead,
> after all) and have X show a solid black background by default.

While on this topic, I recently "synced" the look of ssh-askpass with
the semi-recent changes for the XDM login screen:

ssh-askpass*font:   
-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1
ssh-askpass*foreground: #ff
ssh-askpass*background: #798a99
ssh-askpass.*.borderWidth:  1
ssh-askpass.*.borderColor:  black
ssh-askpass.*.shadowThickness:  0
ssh-askpass.*Button.borderWidth:0
ssh-askpass.*Button.background: #99aab9
ssh-askpass.indicator.borderWidth:  0
ssh-askpass.indicator.background:   #99aab9
ssh-askpass.indicator.foreground:   #fffa06

Not suggesting we modify it, but figured someone else might be
interested :D



Re: morse(6) update

2016-01-17 Thread Aaron Bieber

Stuart Henderson writes:

> Update for the current spec which includes an official prosign for @
> (I'm not sure where the old one we had came from but it's not the right
> thing to use nowadays) and distinct parentheses.
>
> OK?

OK abieber@ if you haven't gotten one yet.

>
> Index: morse.6
> ===
> RCS file: /cvs/src/games/morse/morse.6,v
> retrieving revision 1.1
> diff -u -p -r1.1 morse.6
> --- morse.6   7 Nov 2014 22:17:49 -   1.1
> +++ morse.6   17 Jan 2016 23:45:01 -
> @@ -71,3 +71,9 @@ Produce dots and dashes rather than word
>  .%R "Operational provisions for the international public telegram service"
>  .%O Division B, I. Morse code
>  .Re
> +.Rs
> +.%I ITU-R M.1677-1
> +.%R International Morse code
> +.%D 2009
> +.%U http://www.itu.int/rec/R-REC-M.1677-1-200910-I/
> +.Re
> Index: morse.c
> ===
> RCS file: /cvs/src/games/morse/morse.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 morse.c
> --- morse.c   23 Oct 2015 02:01:15 -  1.17
> +++ morse.c   17 Jan 2016 23:45:01 -
> @@ -89,14 +89,14 @@ struct punc {
>   { '-', "--" },
>   { ':', "---..." },
>   { ';', "-.-.-." },
> - { '(', "-.--.-." }, /* When converting from Morse, can't tell */
> - { ')', "-.--.-." }, /* '(' and ')' apart  */
> + { '(', "-.--." },
> + { ')', "-.--.-" },
>   { '"', ".-..-." },
>   { '`', ".-..-." },
>   { '\'', ".." },
>   { '+', ".-.-." },   /* AR */
>   { '=', "-...-" },   /* BT */
> - { '@', "...-.-" },  /* SK */
> + { '@', ".--.-." },  /* AC */
>   { '\0', NULL }
>  };
>  



Re: xhci problems on Thinkpad X240

2014-11-09 Thread Aaron Bieber

Matthieu Herrb writes:

 Hi,

 my X240 has 2 USB3.0 ports. I use one of them to connect a urtwn(4)
 usb wifi dongle since the internal intel wifi is not (yet) supported. 

 After the recent commit to enable xhci, I tried to switch the BIOS
 USB3 support mode from 'disabled' to 'auto'. This make urtwn0 attach
 to the xhci hub, but it doesn't work (device timeout). See dmesg
 below.

 detaching and re-attaching it doesn't make a difference.

I have the same setup (x240 with urtwn) and ran into the same issue.


 OpenBSD 5.6-current (GENERIC.MP) #44: Sun Nov  9 14:41:25 CET 2014
 matth...@nebraska.herrb.net:/usr/obj/GENERIC.MP
 real mem = 8246276096 (7864MB)
 avail mem = 8022933504 (7651MB)
 warning: no entropy supplied by boot loader
 mpath0 at root
 scsibus0 at mpath0: 256 targets
 mainbus0 at root
 bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdcd3d000 (60 entries)
 bios0: vendor LENOVO version GIET73WW (2.23 ) date 04/10/2014
 bios0: LENOVO 20ALCTO1WW
 acpi0 at bios0: rev 2
 acpi0: sleep states S0 S3 S4 S5
 acpi0: tables DSDT FACP SLIC DBGP ECDT HPET APIC MCFG SSDT SSDT SSDT SSDT 
 SSDT SSDT SSDT SSDT PCCT SSDT TCPA UEFI MSDM ASF! BATB FPDT UEFI SSDT DMAR
 acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3) EHC1(S3)
 acpitimer0 at acpi0: 3579545 Hz, 24 bits
 acpiec0 at acpi0
 acpihpet0 at acpi0: 14318179 Hz
 acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
 cpu0 at mainbus0: apid 0 (boot processor)
 cpu0: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 1995.71 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,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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM
 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
 cpu1 at mainbus0: apid 1 (application processor)
 cpu1: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 1995.38 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,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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM
 cpu1: 256KB 64b/line 8-way L2 cache
 cpu1: smt 1, core 0, package 0
 cpu2 at mainbus0: apid 2 (application processor)
 cpu2: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 1995.38 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,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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM
 cpu2: 256KB 64b/line 8-way L2 cache
 cpu2: smt 0, core 1, package 0
 cpu3 at mainbus0: apid 3 (application processor)
 cpu3: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz, 1995.38 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,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,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM
 cpu3: 256KB 64b/line 8-way L2 cache
 cpu3: smt 1, core 1, package 0
 ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
 acpimcfg0 at acpi0 addr 0xf800, bus 0-63
 acpiprt0 at acpi0: bus 0 (PCI0)
 acpiprt1 at acpi0: bus -1 (PEG_)
 acpiprt2 at acpi0: bus 2 (EXP1)
 acpiprt3 at acpi0: bus 3 (EXP2)
 acpiprt4 at acpi0: bus -1 (EXP3)
 acpicpu0 at acpi0: C3, C1, PSS
 acpicpu1 at acpi0: C3, C1, PSS
 acpicpu2 at acpi0: C3, C1, PSS
 acpicpu3 at acpi0: C3, C1, PSS
 acpipwrres0 at acpi0: PUBS, resource for XHCI, EHC1
 acpitz0 at acpi0: critical temperature is 200 degC
 acpibtn0 at acpi0: LID_
 acpibtn1 at acpi0: SLPB
 acpibat0 at acpi0: BAT0 model 45N1773 serial 16792 type LION oem SANYO
 acpibat1 at acpi0: BAT1 model 45N1738 serial  3066 type LION oem LGC
 acpiac0 at acpi0: AC unit online
 acpithinkpad0 at acpi0
 cpu0: Enhanced SpeedStep 1995 MHz: speeds: 2701, 2700, 2600, 2400, 2300, 
 2100, 2000, 1800, 1700, 1600, 1400, 1300, 1100, 1000, 800, 756 MHz
 pci0 at mainbus0 bus 0
 pchb0 at pci0 dev 0 function 0 Intel Core 4G Host rev 0x0b
 vga1 at pci0 dev 2 function 0 Intel HD Graphics rev 0x0b
 intagp at vga1 not configured
 inteldrm0 at vga1
 drm0 at inteldrm0
 drm: Memory usable by graphics device = 2048M
 error: [drm:pid0:i915_write32] *ERROR* Unknown unclaimed register before 
 writing to 10
 error: [drm:pid0:intel_dp_set_link_train] *ERROR* Timed out waiting for DP 
 idle 

Re: ksh: tab completion fix (again)

2012-09-26 Thread Aaron Bieber
On Thu, Sep 27, 2012 at 01:42:25AM +0400, Alexander Polakov wrote:
 I sent this diff in 2011 (?) with a bunch of other diffs.
 It fixes tab completion for filenames containing special
 characters like [], () and so.
 
 This code affects interactive mode only, and I don't know a way
 to do automated testing of this. Suggestions welcome.
 
Seems to be working for me! Tested with the below:

$ touch bad\]file
$ rm batab 
- which expands to-
$ rm bad\]file
$

  
 
 -- 
 open source wizard



Re: ksh sigwinch

2012-09-09 Thread Aaron Bieber
On Wed, Sep 05, 2012 at 01:11:28PM +0200, LEVAI Daniel wrote:
 On sze, szept 05, 2012 at 07:01:45 -0400, Ted Unangst wrote:
 [...]
   This doesn't work for me inside either urxvt or xterm. I've resized the
   windows but the end of the line remained more far than the windows'
   edge. Do I understand correctly that this patch would make ksh always
   recalculate the editor's line end if a terminal window resize occurs?
  
  The did we get sigwinch code only runs after you hit enter.  The
 [...]
 
 Aha! My bad... It works as advertised after hitting enter.

Working fine here.



Re: FTDI FT2232H

2012-09-09 Thread Aaron Bieber
On Sat, Sep 08, 2012 at 04:47:45PM +0200, Raphael Graf wrote:
 This adds support for the FT2232H and FT4232H serial adapters.
 (FT2232H found on the BeagleBone).
 
 These devices have a 120MHz base clock for the baud rate generator
 and need a different encoding for the baud rate divisor.
 The values for ibufsize/obufsize are now taken from the endpoint descriptors.
 
 I can't be sure that this does not break anything. It would have to be
 tested on various devices.

Testing this with my beaglebone.  When I connect with minicom ( uc
doesn't seem to output anything ), I can see linux booting ( YAY! ), but
I am unable to type anything.
 
 Regards
 Raphael



WIP: Support Synaptics touchpad

2011-03-15 Thread Aaron Bieber
Hi 

I am running the synaptics patch on -current amd64. Seems to be running
great! 

dmesg:
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0

I have touchpad+trackpoint enabled on a lenovo t410 

Cheers,
Aaron