Re: mbsync/isync fails wit pledge "fattr", syscall 76

2018-11-08 Thread Stuart Henderson
On 2018/11/08 01:32, arnaud.brand--o...@tib.cc wrote:
> >Synopsis:mbsync/isync fails wit pledge "fattr", syscall 76
> >Category:pledge or syscall problem
> >Environment:
>   System  : OpenBSD 6.4
>   Details : OpenBSD 6.4-current (GENERIC.MP) #425: Sun Nov  4 
> 21:32:53 MST 2018
>
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
>   Architecture: OpenBSD.amd64
>   Machine : amd64
> >Description:
> Not sure if this was due to ports@, sorry if it's misdirected.

Ideally if it's a porting-related problem (rather than something which
is clearly a problem with the upstream software itself) then the maintainer
should at least be CC'd (I've added him here). ports@ is probably slightly
better than bugs@.

> I just tried to install isync/mbsync to give it a try.
> After figuring out the config file syntax, I launched 'mbsync -a'.
> It failed with a pledge error.
> Since I'm (trying to) follow current I thought it was a because I didn't 
> upgrade before installing isync.
> So I updgraded to the latest snapshot, rebooted, did pkg_add -u, rebooted and 
> retried.
> Same error :
> 
> ccam$ mbsync -a
> C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/0 *0/0 #0/0
> Warning: lost track of 553 pulled message(s)
> C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/556 *0/0 #0/0Abort trap (core dumped)
> 
> And at the end of the dmesg, we can find the pledge error.

You mentioned in subject, but it would be clearer to include this here too, e.g.

mbsync[96869]: pledge "fattr", syscall 76

Using your config (which was useful) I can confirm it.

syscall 76 is utimes() which is done here in maildir_store_msg()
in drv_maildir.c:

1636 if (data->date) {
1637 /* Set atime and mtime according to INTERNALDATE or mtime 
of source message */
1638 struct utimbuf utimebuf;
1639 utimebuf.actime = utimebuf.modtime = data->date;
1640 if (utime( buf,  ) < 0) {
1641 sys_error( "Maildir error: cannot set times for 
%s", buf );
1642 cb( DRV_BOX_BAD, 0, aux );
1643 return;
1644 }
1645 }

This port diff should fix things.

Index: Makefile
===
RCS file: /cvs/ports/mail/isync/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- Makefile22 May 2018 21:24:08 -  1.37
+++ Makefile8 Nov 2018 10:50:20 -
@@ -3,7 +3,7 @@
 COMMENT=   synchronize IMAP4 and maildir mailboxes
 
 DISTNAME=  isync-1.3.0
-REVISION=  3
+REVISION=  4
 
 CATEGORIES=mail
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=isync/}
Index: patches/patch-src_main_c
===
RCS file: /cvs/ports/mail/isync/patches/patch-src_main_c,v
retrieving revision 1.5
diff -u -p -r1.5 patch-src_main_c
--- patches/patch-src_main_c22 May 2018 21:24:08 -  1.5
+++ patches/patch-src_main_c8 Nov 2018 10:50:20 -
@@ -33,14 +33,14 @@ Index: src/main.c
 +  }
 +  } else {
 +  if (needs_proc_exec) {
-+  if (pledge("stdio rpath wpath cpath inet flock dns"
-+  " getpw tty proc exec prot_exec", NULL) == -1) {
++  if (pledge("stdio rpath wpath cpath inet fattr flock"
++  " dns getpw tty proc exec prot_exec", NULL) == -1) {
 +  sys_error("pledge\n");
 +  exit(1);
 +  }
 +  } else {
-+  if (pledge("stdio rpath wpath cpath inet flock dns"
-+  " getpw tty prot_exec", NULL) == -1) {
++  if (pledge("stdio rpath wpath cpath inet fattr flock"
++  " dns getpw tty prot_exec", NULL) == -1) {
 +  sys_error("pledge\n");
 +  exit(1);
 +  }



Re: bwfm fails to load firmware on Asus T100HA

2018-11-08 Thread Jan Johansson
Patrick Wildt  wrote:
> That's why I told you to get back to me.  This text file needs
> to be processed by a tool that strips comments and adds some
> checksum to the file.
> 
> The tool reads the text file and creates an nvram.out that
> should be moved to /etc/firmware/brcmfmac43340-sdio.nvram.
> Simply compile it and invoke it as:

With that it work wounders. I have tested recieving and sending a
250MB file on both wpa2 psk and wpa2 802.1x and got speeds up to
3 MB/s with a stable connection.

Thank you very much for the help!

If there is anything more you want me to try don't hesitate to ask.

Successfull dmesg:
OpenBSD 6.4 (GENERIC.MP) #0: Sun Oct 28 00:20:45 CEST 2018
j...@dax.wenf.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4167061504 (3974MB)
avail mem = 4031483904 (3844MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x7b111000 (19 entries)
bios0: vendor American Megatrends Inc. version "T100HAN.221" date 05/18/2016
bios0: ASUSTeK COMPUTER INC. T100HAN
acpi0 at bios0: rev 2
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI HPET SSDT SSDT 
SSDT SSDT TPM2 LPIT BCFG PRAM CSRT BGRT WDAT SSDT SSDT SSDT MSDM
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Atom(TM) x5-Z8500 CPU @ 1.44GHz, 1440.37 MHz, 06-4c-03
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,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT,MELTDOWN
cpu0: 1MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 79MHz
cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3.3, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Atom(TM) x5-Z8500 CPU @ 1.44GHz, 1439.96 MHz, 06-4c-03
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,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT,MELTDOWN
cpu1: 1MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Atom(TM) x5-Z8500 CPU @ 1.44GHz, 1439.96 MHz, 06-4c-03
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,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT,MELTDOWN
cpu2: 1MB 64b/line 16-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Atom(TM) x5-Z8500 CPU @ 1.44GHz, 1439.96 MHz, 06-4c-03
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,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,SMEP,ERMS,SENSOR,ARAT,MELTDOWN
cpu3: 1MB 64b/line 16-way L2 cache
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 115 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xe000, bus 0-255
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (RP01)
acpiprt2 at acpi0: bus -1 (RP02)
acpiprt3 at acpi0: bus -1 (RP03)
acpiprt4 at acpi0: bus -1 (RP04)
acpiec0 at acpi0: not present
acpicpu0 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), C1(1000@1 
mwait.1), PSS
acpicpu1 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), C1(1000@1 
mwait.1), PSS
acpicpu2 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), C1(1000@1 
mwait.1), PSS
acpicpu3 at acpi0: C3(10@1000 mwait.1@0x64), C2(10@500 mwait.1@0x58), C1(1000@1 
mwait.1), PSS
acpipwrres0 at acpi0: ID3C, resource for ISP3
acpipwrres1 at acpi0: WWPR, resource for SSC1, MDM3
acpipwrres2 at acpi0: WWPR, resource for SSCW, MDM3
acpipwrres3 at acpi0: CLK3, resource for RTEK, RTE2
acpipwrres4 at acpi0: CLK4
acpipwrres5 at acpi0: CLK2
acpipwrres6 at acpi0: CLK0, resource for CAM1
acpipwrres7 at acpi0: CLK1
acpipwrres8 at acpi0: CLK0
acpipwrres9 at acpi0: CLK1, resource for CAM2
acpipwrres10 at acpi0: USBC, resource for XHC1, OTG1
acpipwrres11 at acpi0: P28X, resource for CAM1, CAM2
acpipwrres12 at acpi0: P18X, resource for CAM1, CAM2
acpipwrres13 at acpi0: P12X, resource for CAM1
acpipwrres14 at acpi0: P28P
acpipwrres15 at acpi0: P18P
acpipwrres16 at acpi0: P19X
acpipwrres17 at acpi0: P06X
acpipwrres18 at acpi0: P28T
acpipwrres19 at acpi0: P18D
acpipwrres20 at 

Re: mbsync/isync fails wit pledge "fattr", syscall 76

2018-11-08 Thread Klemens Nanni
On Thu, Nov 08, 2018 at 10:50:47AM +, Stuart Henderson wrote:
> > ccam$ mbsync -a
> > C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/0 *0/0 #0/0
> > Warning: lost track of 553 pulled message(s)
> > C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/556 *0/0 #0/0Abort trap (core 
> > dumped)
> > 
> > And at the end of the dmesg, we can find the pledge error.
> 
> You mentioned in subject, but it would be clearer to include this here too, 
> e.g.
> 
> mbsync[96869]: pledge "fattr", syscall 76
> 
> Using your config (which was useful) I can confirm it.
This is triggered by the `CopyArrivalDate' option I did not account for
back when adding pledge.

> syscall 76 is utimes() which is done here in maildir_store_msg()
> in drv_maildir.c:
> 
> 1636 if (data->date) {
> 1637 /* Set atime and mtime according to INTERNALDATE or 
> mtime of source message */
> 1638 struct utimbuf utimebuf;
> 1639 utimebuf.actime = utimebuf.modtime = data->date;
> 1640 if (utime( buf,  ) < 0) {
> 1641 sys_error( "Maildir error: cannot set times for 
> %s", buf );
> 1642 cb( DRV_BOX_BAD, 0, aux );
> 1643 return;
> 1644 }
> 1645 }
> 
> This port diff should fix things.
Yes, OK kn.

Thanks Stuart for the quick handling!



Re: mbsync/isync fails wit pledge "fattr", syscall 76

2018-11-08 Thread Arnaud BRAND

Le 2018-11-08 12:02, Klemens Nanni a écrit :

On Thu, Nov 08, 2018 at 10:50:47AM +, Stuart Henderson wrote:

> ccam$ mbsync -a
> C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/0 *0/0 #0/0
> Warning: lost track of 553 pulled message(s)
> C: 0/1  B: 0/6  M: +0/0 *0/0 #0/0  S: +0/556 *0/0 #0/0Abort trap (core dumped)
>
> And at the end of the dmesg, we can find the pledge error.

You mentioned in subject, but it would be clearer to include this here 
too, e.g.


mbsync[96869]: pledge "fattr", syscall 76

Using your config (which was useful) I can confirm it.

This is triggered by the `CopyArrivalDate' option I did not account for
back when adding pledge.


syscall 76 is utimes() which is done here in maildir_store_msg()
in drv_maildir.c:

1636 if (data->date) {
1637 /* Set atime and mtime according to INTERNALDATE 
or mtime of source message */

1638 struct utimbuf utimebuf;
1639 utimebuf.actime = utimebuf.modtime = data->date;
1640 if (utime( buf,  ) < 0) {
1641 sys_error( "Maildir error: cannot set 
times for %s", buf );

1642 cb( DRV_BOX_BAD, 0, aux );
1643 return;
1644 }
1645 }

This port diff should fix things.

Yes, OK kn.

Thanks Stuart for the quick handling!


Thanks you Klemens and Stuart, both for the patch and for the posting 
tips !


Sorry to have missed the error line in the debug, it showed when I typed 
"dmesg" but not in the "sendbug" and I failed to double check it.




some weird MDA behaviour

2018-11-08 Thread pjp
>Synopsis:  some weird MDA behaviour, including readers (mutt, dovecot)
>Category:  system
>Environment:
System  : OpenBSD 6.4
Details : OpenBSD 6.4 (GENERIC) #349: Thu Oct 11 13:25:13 MDT 2018
 
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC

Architecture: OpenBSD.amd64
Machine : amd64
>Description:
Hi, earlier today someone posted a mail to misc@ which was not well
received by mutt and dovecot becuase it has a "From " line in it.
Usually those should be escaped when being delivered (with a >).
I did speak to gilles on #opensmtpd about it but I was confused as
to what the mail.local source code really is.  I looked at the wrong
part.  So I set up my test environment and tried to reproduce on 6.4.
I even produced a patch, later below.
>How-To-Repeat:
Script started on Thu Nov  8 16:49:30 2018
upsilon$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 upsilon.virgostar.net ESMTP OpenSMTPD
helo remote
250 upsilon.virgostar.net Hello remote [127.0.0.1], pleased to meet you
mail from: 
250 2.0.0: Ok
rcpt to: 
250 2.1.5 Destination address valid: Recipient ok
data
354 Enter mail, end with "." on a line by itself
From: 
To: 
Subject: testing


upsilon# head /var/mail/root
>From dera...@do-not-reply.openbsd.org Sun Apr 15 06:30:00 MDT 2018
Return-Path: root
Date: Apr 15 06:30:00 MDT 2018
From: dera...@do-not-reply.openbsd.org (Theo de Raadt)
To: root
Subject: Welcome to OpenBSD 6.3!

This message attempts to describe the most basic initial questions that a
system administrator of an OpenBSD box might have.  You are urged to save
this message for later reference.

-peter


.
250 2.0.0: b44401e2 Message accepted for delivery
quit
221 2.0.0: Bye
Connection closed by foreign host.
upsilon$ mailq
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/pjp": 2 messages 1 new
1 pjp@upsilon.virgo  Thu Nov  8 16:49   31/1094  test
>N  2 p...@centroid.eu   Thu Nov  8 16:50   37/1318  testing
& q
Held 2 messages in /var/mail/pjp
upsilon$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 upsilon.virgostar.net ESMTP OpenSMTPD
helo remote
250 upsilon.virgostar.net Hello remote [127.0.0.1], pleased to meet you
mail from: 
250 2.0.0: Ok
rcptoto: 
250 2.1.5 Destination address valid: Recipient ok
data
354 Enter mail, end with "." on a line by itself
From: 
To: 
Subject: testing


upsilon# head /var/mail/root
>From dera...@do-not-reply.openbsd.org Sun Apr 15 06:30:00 MDT 2018
Return-Path: root
Date: Apr 15 06:30:00 MDT 2018
From: dera...@do-not-reply.openbsd.org (Theo de Raadt)
To: root
Subject: Welcome to OpenBSD 6.3!

This message attempts to describe the most basic initial questions that a
system administrator of an OpenBSD box might have.  You are urged to save
this message for later reference.

-peter
.
250 2.0.0: 287ec1b8 Message accepted for delivery
quit
221 2.0.0: Bye
Connection closed by foreign host.
upsilon$ mutt

upsilon$ mail
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/pjp": 3 messages 2 unread
1 pjp@upsilon.virgo  Thu Nov  8 16:49   31/1094  test
>U  2 p...@centroid.eu   Thu Nov  8 16:50   38/1329  testing
 U  3 p...@centroid.eu   Thu Nov  8 16:50   43/1395  testing
& q
Held 3 messages in /var/mail/pjp
Script done on Thu Nov  8 16:51:53 2018

for some reason the "mail" program seems to render it right.  But
mutt doesn't it showed the Welcome mail that I "injected" as a 
seperate mail.
>Fix:
I wrote this patch to /usr/libexec/mail.local there was a variable
that didn't seem to have any effect and it caused skipping the
"From " check becuase it was always set to 0 except for the first
line.

Index: mail.local.c
===
RCS file: /cvs/src/libexec/mail.local/mail.local.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 mail.local.c
--- mail.local.c12 Dec 2015 20:09:28 -  1.35
+++ mail.local.c8 Nov 2018 16:05:47 -
@@ -117,7 +117,7 @@ storemail(char *from)
 {
FILE *fp = NULL;
time_t tval;
-   int fd, eline;
+   int fd;
size_t len;
char *line, *tbuf;
 
@@ -131,7 +131,7 @@ storemail(char *from)
(void)time();
(void)fprintf(fp, "From %s %s", from, ctime());
 
-   for (eline = 1, tbuf = NULL; (line = fgetln(stdin, ));) {
+   for (tbuf = NULL; (line = fgetln(stdin, ));) {
/* We have to NUL-terminate the line since fgetln does not */
if (line[len - 1] == '\n')
line[len - 1] = '\0';
@@ -143,13 +143,10 @@ storemail(char *from)
tbuf[len] = '\0';
line = tbuf;
}
-   if (line[0] == '\0')
-   eline = 1;
-