openbsd interview questions
Top openbsd frequently asked interview questions
I have recently been reading up on the D programming language, and am interested in using it for a small application that would run on OpenBSD.
As far as I can see there is no OpenBSD port for the compiler, but I can see a reference to OpenBSD in the posix.mak file. I don't have an OpenBSD development environment handy at the moment, so before I go and prepare one I was wondering if anyone has tried developing with D on OpenBSD.
How did it go? Was it easy to setup? Are there any 'gotchas' to be aware of? Thanks in advance.
Source: (StackOverflow)
Has anyone been able to get xinc to run correctly under OpenBSD's chrooted default Apache? I'd like to keep our development server running fully chrooted just like our Production server so that we make sure our code runs just fine chrooted.
Source: (StackOverflow)
Has anyone gotten VisualWorks running under OpenBSD? It's not an officially supported platform, but one of the Cincom guys was telling me that it should be able to run under a linux compatibility mode. How did you set it up?
I already have Squeak running without a problem, so I'm not looking for an alternative. I specifically need to run VisualWorks's Web Velocity for a project.
Thanks,
Source: (StackOverflow)
I'm setting up a computer running OpenBSD that I wish to play all the music I will ever want. I want it to basically set in a corner and do it's thing. The problem with that is that I want to control it from wherever I am. I can do that (though not extremely easily) with ssh from my computer. I think it'd be really cool to control(as in, choose songs, skip, pause, volume control, etc) it from a simple web page so I could access it from my phone, as well as my computer.
So, I'd prefer to use mplayer for this. Is there any way of controlling mplayer from say a PHP script or something similar?
Source: (StackOverflow)
There is a cool utility out there called sshuttle (https://github.com/apenwarr/sshuttle). It has depended on ipfw to forward packets in the past. It appears that ipfw is mostly broken in Mavericks and the advice is to use PacketFilter for this now.
I've spent most of the day looking at PacketFilter and it appears ipfw has a feature that PacketFilter does not support (hope I'm wrong about this).
The following rule:
ipfw -q add 12300 fwd 127.0.0.1,12300 tcp from any to any not ipttl 42 keep-state setup
will forward all traffic to 127.0.0.1 (localhost) port 12300. It does not, however, change the destination IP or port in the TCP packet. This is important to sshuttle as it uses the information about the original destination to forward the packet on to another network.
The closest rule I can find in the PacketFilter world is:
rdr pass proto tcp from any to any -> 127.0.0.1 port 12300
This rule does send the traffic to 127.0.0.1 (localhost) port 12300 but it also rewrites the destination address to be 127.0.0.1.
Any ideas on how to get the behavior sshuttle needs in OS X?
Source: (StackOverflow)
Why zsh: command not found: bundle
after gem install bundler
?
I tried setting path=( /usr/local/lib/ruby/gems/2.2/gems/ ~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin )
in /etc/zshrc
and source /etc/zshrc
to no avail.
root@dev:/home/dev# gem install bundler
Successfully installed bundler-1.7.12
Parsing documentation for bundler-1.7.12
Done installing documentation for bundler after 10 seconds
1 gem installed
root@dev:/home/dev# bundle
zsh: command not found: bundle
root@dev:/home/dev# uname -a
OpenBSD dev.my.domain 5.7 GENERIC#748 amd64
root@dev:/home/dev# gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-openbsd]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.2
- RUBY EXECUTABLE: /usr/local/bin/ruby22
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-openbsd
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.2
- /usr/local/lib/ruby/gems/2.2/gems/
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/lib/ruby/gems/2.2/gems/
- /root/bin
- /bin
- /sbin
- /usr/bin
- /usr/sbin
- /usr/local/bin
- /usr/local/sbin
Source: (StackOverflow)
Look at the following implementations of the "echo" command:
As you go down the list, I'm sure you'll notice the increasing bloat in each implementation.
What is the point of a 272 line echo program?
Source: (StackOverflow)
Found myself looking at the arc4random_uniform source (http://bxr.su/o/lib/libc/crypt/arc4random_uniform.c)
My question relates to the following line (the comment is their original comment) :
/* 2**32 % x == (2**32 - x) % x */
min = -upper_bound % upper_bound;
Now, I'm no mathematics genius, but surely -N%N will always equal zero. So why not just write
min=0
Source: (StackOverflow)
I would like to use OpenBSD's implementation of malloc, realloc and free on my Debian lenny desktop rather than glibc's.
Are they simply drop in replacements: will they work on my Linux desktop ?
Which are the file(s) that I need and which OpenBSD package contains them ?
Source: (StackOverflow)
The root cause for this question is my attempt to write tests for a new option/argument processing module (OptArgs) for Perl. This of course involves parsing @ARGV
which I am doing based on the answers to this question. This works fine on systems where I18N::Langinfo::CODESET is defined[1].
On systems where langinfo(CODESET)
is not available I would like to at least make a best effort based on observed behaviour. However my tests so far indicate that some systems I cannot even pass a unicode argument to an external script properly.
I have managed to run something like the following on various systems where "test_script" is a Perl script that merely does a print Dumper(@ARGV)
:
use utf8;
my $utf8 = '¥';
my $result = qx/$^X test_script $utf8/;
What I have found is that on FreeBSD the test_script receives bytes which can be decoded into Perl's internal format. However on OpenBSD and Solaris test_script appears to get the string "\x{fffd}\x{fffd}"
which contains only the unicode replacement character (twice?).
I don't know the mechanism underlying the qx
operator. I presume it either exec
's or shells out, but unlike filehandles (where I can binmode them for encoding) I don't know how to ensure it does what I want. Same with system()
for that matter. So my question is what am I not doing correctly above? Otherwise what is different with Perl or the shell or the environment on OpenBSD and Solaris?
[1] Actually I think so far that is only Linux according to CPAN testers results.
Update(x2): I currently have the following running its way through cpantester's setups to test Schwern's hypothesis:
use strict;
use warnings;
use Data::Dumper;
BEGIN {
if (@ARGV) {
require Test::More;
Test::More::diag( "\npre utf8::all: "
. Dumper( { utf8 => $ARGV[0], bytes => $ARGV[1] } ) );
}
}
use utf8;
use utf8::all;
BEGIN {
if (@ARGV) {
Test::More::diag( "\npost utf8::all: "
. Dumper( { utf8 => $ARGV[0], bytes => $ARGV[1] } ) );
exit;
}
}
use Encode;
use Test::More;
my $builder = Test::More->builder;
binmode $builder->output, ':encoding(UTF-8)';
binmode $builder->failure_output, ':encoding(UTF-8)';
binmode $builder->todo_output, ':encoding(UTF-8)';
my $utf8 = '¥';
my $bytes = encode_utf8($utf8);
diag( "\nPassing: " . Dumper( { utf8 => $utf8, bytes => $bytes, } ) );
open( my $fh, '-|', $^X, $0, $utf8, $bytes ) || die "open: $!";
my $result = join( '', <$fh> );
close $fh;
ok(1);
done_testing();
I'll post the results on various systems when they come through. Any comments on the validity andor correctness of this would be apprecicated. Note that it is not intended to be a valid test. The purpose of the above is to be able to compare what is received on different systems.
Resolution: The real underlying issue turns out to be something not addressed in my question nor by Schwern's answer below. What I discovered is that some cpantesters machines only have an ascii locale installed/available. I should not expect any attempt to pass UTF-8 characters to programs in this type of environment to work. So in the end my problem was invalid test conditions, not invalid code.
I have seen nothing so far to indicate that the qx
operator or the utf8::all
module have any effect on how parameters are passed to external programs. The critical component appears to be the LANG
and/or LC_ALL
environment variables, to inform the external program what locale they are running in.
By the way, my original assertion that my code was working on all systems where I18N::Langinfo::CODESET is defined was incorrect.
Source: (StackOverflow)
I want to use home, end, delete, pageup, pagedown with ksh. My TERM is
xterm-color. These keys works fine with tcsh and zsh, but not with ksh
(print a tilde ~)
I found this:
bind '^[[3'=prefix-2
bind '^[[3~'=delete-char-forward
bind '^[[1'=prefix-2
bind '^[[1~'=beginning-of-line
bind '^[[4'=prefix-2
bind '^[[4~'=end-of-line
But when I set one bindkey, the last does not work anymore.
How can I use these keys in ksh with a .kshrc ?
Thanks.
Source: (StackOverflow)
How easy is it to get a Python that isn't linked to GNU Readline on FreeBSD or OpenBSD? Is GNU Readline the default for Python readline-like support on these systems? If so, is it easy to remove this dependency?
Source: (StackOverflow)
Sorry, the headline might be a bit irritating, but I didn't know anything better. Anyway, I want a bash script to work on FreeBSD, OpenBSD and Linux without modifying it, but bash isn't located at the same place in Linux and BSD.
So, if I write #!/bin/bash
then it won't work on BSD, because the bash shell is located in /usr/local/bin/bash
there. Is there any solution to get this script working on both?
Or do I really need to ship two scripts with different paths...?
Source: (StackOverflow)
9 with nginx and php-fpm.
Everything worked fine until this day notice that this very very slow everything that has to do with php.
Sometimes I get the error
“504 Gateway Time-Out”
I wonder if there is a way to get scanned that is what is causing this.
Thank you
I have done so OPcache settings:
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
Nginx as follows:
worker_processes 6;
events {
worker_connections 8096;
multi_accept on;
use kqueue;
}
worker_rlimit_nofile 40000;
http {
.....
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
server_tokens off;
......
}
php-fpm like this:
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
request_terminate_timeout = 30s
request_slowlog_timeout = 10s
slowlog = /var/log/php-fpm/default/slow.log
php_admin_flag[log_errors] = on
and php.ini like this:
max_execution_time = 300
request_terminate_timeout = 300
Thanks for all
Source: (StackOverflow)
I am using OpenBSD installed with perl, apache, firefox, gedit. I am trying to run foswiki on OpenBSD.
Whenever i try to run
http://127.0.0.1/foswiki/bin/configure
it gives 500 internal server Error. When i checked Logs it revels following information.
[Wed Mar 19 08:24:33 2014] [error] (2)No such file or directory: exec
of /htdocs/foswiki/bin/configure failed
[Wed Mar 19 08:24:33 2014] [error] [client 127.0.0.1] Premature end of
script headers: /htdocs/foswiki/bin/configure
Can someone guide on what is the issue and how do i resolve. ?
Regards
Location of files: /var/www/htdocs/foswiki
The httpd.conf
file has following configuration.
> ServerType standalone
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
Include /var/www/conf/modules/*.conf
> DocumentRoot "/var/www/htdocs"
>
>
> ScriptAlias /foswiki/bin "/var/www/htdocs/foswiki/bin"
>
> Alias /foswiki "/var/www/htdocs/foswiki" Alias /foswiki/pub
> "/var/www/foswiki/pub"
>
> <Directory "/var/www/htdocs/foswiki">
> Order Allow,Deny
> Allow from all
> Deny from env=blockAccess </Directory>
>
> <Directory "/var/www/htdocs">
> Order Allow,Deny
> Allow from all
> Deny from env=blockAccess </Directory>
>
>
> <Directory "/var/www/htdocs/foswiki/bin">
> AllowOverride None
> Order Allow,Deny
> Allow from all
> Deny from env=blockAccess
>
> Options ExecCGI FollowSymLinks
> SetHandler cgi-script
>
> </Directory>
Source: (StackOverflow)