Re: cpu cores

2024-06-08 Thread Andreas Kähäri
On Sat, Jun 08, 2024 at 11:39:28AM +0100, Kirill A. Korinsky wrote:
> On Sat, 08 Jun 2024 11:09:29 +0100,
> Omar Polo  wrote:
> > 
> > On 2024/06/08 10:09:07 +0100, Kirill A. Korinsky  wrote:
> > > On Sat, 08 Jun 2024 04:57:49 +0100,
> > > Gustavo Rios  wrote:
> > > > 
> > > > i have installed obsd on my dell notebook 8 cores processor. When i 
> > > > execute
> > > > the top utility, it is showed the cores, from 0 (cpu0) to 7 (cpu7), but
> > > > cpu1 and cpu3 is not listed. What is the problem ?
> > > > 
> > > 
> > > A blind guess: sysctl hw.smt=1 may return your hypertreading cores.
> > 
> > which is a very bad advice to give.  There's a reason sysctl hw.smt=1
> > defaults to that value.  One should rather give a "blind guess" of "your
> > hyperthread cores are disabled by default" rather than give a bad advice
> > without explanation.
> 
> I'll make my advice cleaner, I defently mean that missed cores probably is
> disabled becuae it is hyperthreading ones which can be seen as offline in
> htop, or enable via sysctl.


Not knowing too much about these things, I think it looks a bit strange
that *two* out of eight CPUs are disabled due to hypethreading.  I would
have expected every second one be disabled, i.e., four out of eight.



> 
> Also, I'd like to add that from security point of view SMT in general and
> hyperthreading as an example is very bad idea.
> 
> Thus, here old but interesting results that enabling hyperthreading has
> negative effect on performance of have CPU used applications:
> https://web.archive.org/web/20220325090914/http://users.telenet.be/nicvroom/performanceP4.htm
> 
> -- 
> wbr, Kirill

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



Re: Favorite configuration and system replication tools?

2024-05-12 Thread Andreas Kähäri
On Sun, May 12, 2024 at 08:08:17PM +1000, Alexis wrote:
> Andreas Kähäri  writes:
> 
> > Well, that's one way to control this trainwreck of a script; just say
> > that any name containing "inappropriate" characters aren't allowed!
> > 
> > May I ask why you don't simply use rsync(1) (or even openrsync(1) from
> > the OpenBSD base system)?
> 
> i'm not sure why you're addressing this to me, as i'm not the OP.

It's addressed to the thread in general.

> 
> That said, yes, minimising the extent to which certain non-'word' characters
> (i.e. roughly the POSIX 'alnum' class as described in re_format(7)) _can_
> make it easier to programatically do certain tasks which are restricted by
> the long and messy history of C and Unix development. Given that i've been
> using computers for a few decades, i still instinctively don't use spaces in
> filenames, even though they're very much allowed. But of course, that's not
> what most of the world does, and this is an example of trying to work out
> what the best tradeoffs might be when dealing with the messiness of the real
> world.
> 
> 
> Alexis.

With rsync(1):

rsync -n -aim --delete-excluded \
--include-from=list \
--include='*/' \
--exclude='*' \
source/ target

This would read your inclusion patterns from the file "list" (it is
assumed that directories are entered as "dirname/***", which matches the
name "directory" and all its content), include any directory, and then
finaly exclude anything not already included.  The matched names would
be synchonised from beneath "source" to "target", and excluded names
would be deleted from the target.  With "-m", we don't keep directories
at the target that ends up being empty.

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



Re: Favorite configuration and system replication tools?

2024-05-12 Thread Andreas Kähäri
On Sun, May 12, 2024 at 07:56:55PM +1000, Alexis wrote:
> Andreas Kähäri  writes:
> 
> > The ksh(1) shell sets IFS by default to a space, tab and a newline
> > character.
> 
> Those are the defaults used when IFS is not set _as a variable_. If you log
> in, and run env(1), in the absence of any manual setting of IFS in .kshrc or
> whatever, you'll see that IFS is not listed, because it's not 'set' in the
> shell variable sense. When it's not set, the shell assumes that IFS has the
> value you listed.
> 
> (Additionally, a shell variable not being set is _not_ the same as that
> variable being set to the empty string.)
> 
> 
> Alexis.

The external env(1) utility will only ever list environment variables.
The IFS variable does not need to be exported as an environment variable
as it's only ever used by the current shell (and any new shell would
reset it).

To list all variables in a shell, use the built-in set utility without
any arguments.

$ (unset -v IFS; ksh -c 'set' | grep -A 1 IFS)
IFS='
'

$ (unset -v IFS; ksh -c 'printf "%s" "$IFS" | hexdump -C')
  20 09 0a  | ..|
0003



-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



Re: Favorite configuration and system replication tools?

2024-05-12 Thread Andreas Kähäri
On Sun, May 12, 2024 at 07:31:41PM +1000, Alexis wrote:
> Страхиња Радић  writes:
> 
> > When `while ... read ...` idiom is used, it is advisable to clear IFS to
> > turn off field splitting
> 
> *nod* Fair point; it's not set by default, so i didn't think to note that
> any manual setting of it should be overridden for this.

The ksh(1) shell sets IFS by default to a space, tab and a newline
character.

> 
> > and use -r to avoid interpretation of backslash sequences in the input:
> 
> i wondered about that in this context. If people putting odd / inappropriate
> things in directory names are a concern ("weird characters", as you wrote
> upthread), what do we do about the possibility of someone having consciously
> put e.g. a \t in a directory name because they were assuming that it _would_
> get interpreted when required?
> 
> 
> Alexis.


Well, that's one way to control this trainwreck of a script; just say
that any name containing "inappropriate" characters aren't allowed!

May I ask why you don't simply use rsync(1) (or even openrsync(1) from
the OpenBSD base system)?



-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.



Re: Mouse moving on its own, kbd typing on its own

2024-03-11 Thread Andreas Kähäri
On Fri, Mar 08, 2024 at 09:43:58PM +0500, ofthecentury wrote:
> I have a USB mouse that starts to move a little
> on its own once in a while when I'm browsing
> the internet using chromium. My USB keyboard
> is also acting up...it just started typing spaces all
> of a sudden as I was typing up this email and
> wasn't reactive to any input until I unplugged it
> and plugged it back in.
> Is it Chromium? Or is it OpenBSD? I think it's
> Chromium, but how to get to the bottom of it?
> I'm on OpenBSD 7.5 right now, but I've seen it
> on OpenBSD 7.4. And I've seen this on my
> Fedora 39 installation before, by the way. I think
> it's a major security flaw somewhere.

Consider vacuuming your keyboard a bit every once in a while, and clean
your mouse.

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.



Re: Single partition fs layout

2024-02-13 Thread Andreas Kähäri
On Tue, Feb 13, 2024 at 04:52:08PM +0300, Odhiambo Washington wrote:
> On Tue, Feb 13, 2024 at 4:12 PM Janne Johansson  wrote:
> 
> > Den tis 13 feb. 2024 kl 13:40 skrev Odhiambo Washington <
> > odhia...@gmail.com>:
> > >
> > > Is there a disadvantage to having this layout style where everything is
> > on
> > > 1 partition?
> >
> > A few. The partitioning scheme allow certain parts of the filesystem
> > to have different permissions,
> >
> > /dev/sd1a on / type ffs (local)
> > /dev/sd1e on /home type ffs (local, nodev, nosuid)
> > /dev/sd1d on /usr type ffs (local, nodev)
> > /dev/sd0a on /usr/local type ffs (local, nodev, wxallowed)
> >
> > but also if something decides to log like crazy and fills up /var and
> > you have /var ( or /var/log ) as a separate partition, the rest of the
> > system is not affected by it going full and it might be lots easier to
> > recover from it when the rest of the paths work as expected.
> >
> > It's a tradeoff between having to know in advance where data will go
> > or not, versus being able to prevent some nasty issues that could
> > occur if you let someone else run code on your machine.
> >
> > For a throwaway VM that you can reproduce, it would not matter so
> > much. For a box you really care about and is meant to run for yeats,
> > it matters more.
> >
> > --
> > May the most significant bit of your life be positive.
> >
> 
> Hello Janne,
> 
> Thanks a million for such a nice explanation.
> Let me now ask Google about those flags.

It would be better to read the mount(8) manual page, as it explains
what the mount options mean in the context of OpenBSD.

See "man mount" or, if you have to use a web browser, the online manual
at http://man.openbsd.org/mount.8


-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.



Re: OpenBSD 7.3 found a process with PID 0

2023-09-26 Thread Andreas Kähäri
On Tue, Sep 26, 2023 at 04:59:22PM +0200, Alessandro Baggi wrote:
> Hi list,
> running this python3 script:
> 
> #!/usr/bin/env python3
> import psutil
> 
> pids = psutil.pids()
> for i in pids:
> p = psutil.Process(i)
> with p.oneshot():
> print(str(i) + " " + p.name())
> 
> The result start with:
> 
> 0 swapper
> 1 init
> 536 smtpd
> 868 ksh
> ...
> 
> This process does not appear in ps, top and htop.

$ ps -p 0
  PID TT  STATTIME COMMAND
  0 ??  DK   0:02.19 (swapper)

For top, you need to press S to show system processes.  I don't use
htop, but I assume it has a similar capability to show system processes.

> 
> How could be that there is a process with PID 0 before init?
> Probably I'm missing something about OpenBSD core.
> 
> Can someone point me in the right direction?
> 

See uvm_init(9):

 The swapper process swaps in runnable processes that are
 currently swapped out, if there is room.


> Thank you in advance.
> 
> Alessandro.

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.



Re: desire for journaled filesystem

2023-09-05 Thread Andreas Kähäri
On Tue, Sep 05, 2023 at 08:54:58AM -0400, John Holland wrote:
> I just had a kernel panic when reloading a firefox tab pointed at facebook.
> After restarting, all the filesystems had errors but /home was particularly
> bad and caused the boot to stop and prompt if I wanted to enter a root
> shell.
> 
> 
> I eventually got fsck to mark the /home filesystem clean but it found >4000
> lost files that it moved to lost I am not so experienced with this,
> running "file" on a few of them shows that they may be intact files but they
> have numeric names now.
[cut]


A regular external backup would have saved your data no matter what
filesystem you might have been using.  There are a few different backup
solutions available in the ports tree.  I use restic, both on OpenBSD
and macOS.


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.