Custom Search

Wednesday, January 26, 2011

Midnight Commander

Got around to try using mc(1) (Midnight Commander)
for ftp and ssh file operations. Didn’t have any problem
with ssh, but I couldn’t get anything going with ftp except
errors, especially:

ftpfs: invalid value for ai_flags

Read the man page and the Makefile, searched some of
the OpenBSD mailing lists, and came up with:

Midnight Commander error on 4.7:

Here’s a snippet from that link:

I’m not a good C coder, so I just did some basic
research and replaced line 703 in ftpfs.c:
old: “hints.ai_flags = AI_ADDRCONFIG;”.
new: “hints.ai_flags = 1;”

Now it works as expected.


I didn’t have any idea how to do the above, but figured
it was time I learned, so first I used pkg_delete(1) to
uninstall mc(1). I knew when you build a port it will
download the port file and extract all its files in
subdirectories under /usr/ports. I found the file I
needed, ftpfs.c, under:

/data2/mktemp/obj/mc-4.7.0.6p0/mc-4.7.0.6/lib/vfs/mc-vfs

That’s because of limited space on my main drive and
fixing that problem by creating /etc/mk.conf and adding:

WRKOBJDIR=/data2/mktemp/obj
DISTDIR=/data2/mktemp/distfiles
PACKAGE_REPOSITORY=/data2/mktemp/packages


I edited ftpfs.c as described above, deleted the installed
package, changed directory into /usr/ports/misc/mc,
and did:

sudo make -D –with-vfs -D –with-samba \
-D –with-screen=slang -D –with-subshell \
-D –enable-charset


I don’t know if there is a way to tie all those together
without all the extra -D’s, and comments are welcome,
but I was tired at that point of all the searching to fix the
problem, so I did it the long way and it worked. Then I
did make install, then opened mc and this time ftp worked.
Mission accomplished! :-)

Labels: , , , , ,

2 Comments:

Anonymous Anonymous said...

Just a note, this was apparently solved 5 months ago.

"update to 4.7.0.8 and fix ftp support by not using linux specific ai_flags"

http://www.openbsd.org/cgi-bin/cvsweb/ports/misc/mc/patches/

1/27/2011 01:45:00 AM  
Blogger Dennyboy said...

Wasn't solved for me. I didn't even know about it until I started trying to ftp with mc. That's when I found out and started searching for a way to fix it. And I'm running the latest release of OpenBSD, so it's still an existing problem, apparently, with 4.8 Release ports and packages. Might be fixed in current, I haven't checked, but I'm not running that, not even stable, just release with all applicable patches up to date. I'm always learning and for me this was a learning experience, which is mostly what this blog is for. Just kind of journal, I guess, with hopefully some stuff that helps others from time to time.

1/27/2011 03:47:00 AM  

Post a Comment

<< Home