Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Plan 9 #3701

Closed
wants to merge 8 commits into from
Closed

Port to Plan 9 #3701

wants to merge 8 commits into from

Conversation

lufia
Copy link
Contributor

@lufia lufia commented Mar 24, 2019

I've ported to Plan 9(9legacy).

Plan 9 don't have both GNU autotools and perl, and porting these is very hard, so I decide that create config-plan9.h and mkfiles manually.

lib/mkfile Outdated
urlapi-int.h\

LIB=/$objtype/lib/ape/libcurl.a
</sys/src/cmd/mklib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would urge you to either make this use the lib/Makefile.inc file directly somehow, or if that isn't possible, make a build script that generates the necessary include file using that file as input. We do change file names and remove/add files every now and then so having the list of source files in separate files like this will make this port rather fragile going forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, reading further, this is addressed with the below mkfile.inc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I updated mkfile so that it use mkfile.inc.
The operator <| on mkfile executes an argument, and evals stdout of the result.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I was commenting a bit prematurely before reading all of the diff.

@bagder
Copy link
Member

bagder commented Mar 24, 2019

checksrc found a new file without a copyright statement: (I'd advice to copy a source header from another file and update the copyright line as you see fit)

(/usr/local/bin/perl ./checksrc.pl -D. -W./curl_config.h  ./*.[ch] ./vauth/*.[ch] ./vtls/*.[ch])
./config-plan9.h:1:1: error: Missing copyright statement (COPYRIGHT)

@bagder
Copy link
Member

bagder commented Mar 25, 2019

For some reason, the travis CI builds don't run on "draft" pull requests, so expect a large number of more tests and builds when you turn this into to a "real" pull request.

@lufia lufia marked this pull request as ready for review March 26, 2019 12:51
@lufia
Copy link
Contributor Author

lufia commented Mar 27, 2019

AppVeyor error
test 1501...[FTP with multi interface and slow LIST response ]
 1501: protocol FAILED:
--- log/check-expected	2019-03-26 19:38:46.646528700 +0000
+++ log/check-generated	2019-03-26 19:38:46.646528700 +0000
@@ -4,5 +4,3 @@
 CWD 1501[CR][LF]
 EPSV[CR][LF]
 TYPE A[CR][LF]
-LIST[CR][LF]
-QUIT[CR][LF]
== Contents of files in the log/ dir after test 1501
=== Start of file check-expected
 USER anonymous[CR][LF]
 PASS ftp@example.com[CR][LF]
 PWD[CR][LF]
 CWD 1501[CR][LF]
 EPSV[CR][LF]
 TYPE A[CR][LF]
 LIST[CR][LF]
 QUIT[CR][LF]
=== End of file check-expected
=== Start of file check-generated
 USER anonymous[CR][LF]
 PASS ftp@example.com[CR][LF]
 PWD[CR][LF]
 CWD 1501[CR][LF]
 EPSV[CR][LF]
 TYPE A[CR][LF]
=== End of file check-generated
=== Start of file dict_server.log
 2019-03-26 19:38:10,020 INFO  [DICT] Listening on (u'localhost', 9015)
=== End of file dict_server.log
=== Start of file ftp_server.log
 19:38:12.224655 ====> Client connect
 19:38:12.225105 FTPD: Getting commands from log/ftpserver.cmd
 19:38:12.225225 FTPD: delay reply for LIST with 2 seconds
 19:38:12.225324 FTPD: delay reply for TYPE with 2 seconds
 19:38:12.225450 > "220-        _   _ ____  _     [CR][LF]220-    ___| | | |  _ \| |    [CR][LF]220-   / __| | | | |_) | |    [CR][LF]220-  | (__| |_| |  _ {| |___ [CR][LF]220    \___|\___/|_| \_\_____|[CR][LF]"
 19:38:12.226798 < "USER anonymous"
 19:38:12.226987 > "331 We are happy you popped in![CR][LF]"
 19:38:12.228020 < "PASS ftp@example.com"
 19:38:12.228136 > "230 Welcome you silly person[CR][LF]"
 19:38:12.229206 < "PWD"
 19:38:12.229321 > "257 "/" is current directory[CR][LF]"
 19:38:12.230331 < "CWD 1501"
 19:38:12.230442 > "250 CWD command successful.[CR][LF]"
 19:38:12.231502 < "EPSV"
 19:38:12.231603 ====> Passive DATA channel requested by client
 19:38:12.231683 DATA sockfilt for passive data channel starting...
 19:38:18.177778 DATA sockfilt for passive data channel started (pid 3896)
 19:38:18.178327 DATA sockfilt for passive data channel listens on port 2441
 19:38:18.178459 > "229 Entering Passive Mode (|||2441|)[LF]"
 19:38:18.178552 Client has been notified that DATA conn will be accepted on port 2441
 19:38:22.880903 Client connects to port 2441
 19:38:22.881108 ====> Client established passive DATA connection on port 2441
 19:38:27.630902 < "TYPE A"
 19:38:27.631080 Sleep for 2 seconds
 19:38:30.130907 > "200 I modify TYPE as you wanted[CR][LF]"
 19:38:30.130907 MAIN sockfilt said DISC
 19:38:30.131001 ====> Client disconnected
=== End of file ftp_server.log
=== Start of file ftp_sockctrl.log
 19:38:13.046000 select_ws: 160 is readable
 19:38:13.046000 ====> Client connect
 19:38:13.046000 select_ws: 0 is readable
 19:38:13.046000 Received DATA (on stdin)
 19:38:13.046000 > 160 bytes data, server => client
 19:38:13.046000 '220-        _   _ ____  _     \r\n220-    ___| | | |  _ \| | '
 19:38:13.046000 '   \r\n220-   / __| | | | |_) | |    \r\n220-  | (__| |_| |  '
 19:38:13.046000 '_ {| |___ \r\n220    \___|\___/|_| \_\_____|\r\n'
 19:38:13.046000 select_ws: 168 is readable
 19:38:13.046000 < 16 bytes data, client => server
 19:38:13.046000 'USER anonymous\r\n'
 19:38:13.046000 select_ws: 0 is readable
 19:38:13.046000 Received DATA (on stdin)
 19:38:13.046000 > 33 bytes data, server => client
 19:38:13.046000 '331 We are happy you popped in!\r\n'
 19:38:13.046000 select_ws: 168 is readable
 19:38:13.046000 < 22 bytes data, client => server
 19:38:13.046000 'PASS ftp@example.com\r\n'
 19:38:13.046000 select_ws: 0 is readable
 19:38:13.046000 Received DATA (on stdin)
 19:38:13.046000 > 30 bytes data, server => client
 19:38:13.046000 '230 Welcome you silly person\r\n'
 19:38:13.046000 select_ws: 168 is readable
 19:38:13.046000 < 5 bytes data, client => server
 19:38:13.046000 'PWD\r\n'
 19:38:13.046000 select_ws: 0 is readable
 19:38:13.046000 Received DATA (on stdin)
 19:38:13.046000 > 30 bytes data, server => client
 19:38:13.046000 '257 "/" is current directory\r\n'
 19:38:13.046000 select_ws: 168 is readable
 19:38:13.046000 < 10 bytes data, client => server
 19:38:13.046000 'CWD 1501\r\n'
 19:38:13.046000 select_ws: 0 is readable
 19:38:13.046000 Received DATA (on stdin)
 19:38:13.046000 > 29 bytes data, server => client
 19:38:13.046000 '250 CWD command successful.\r\n'
 19:38:13.046000 select_ws: 168 is readable
 19:38:13.046000 < 6 bytes data, client => server
 19:38:13.046000 'EPSV\r\n'
 19:38:19.000000 select_ws: 0 is readable
 19:38:19.000000 Received DATA (on stdin)
 19:38:19.000000 > 37 bytes data, server => client
 19:38:19.000000 '229 Entering Passive Mode (|||2441|)\n'
 19:38:28.453000 select_ws: 168 is readable
 19:38:28.453000 select_ws: 168 is excepted
 19:38:28.453000 < 8 bytes data, client => server
 19:38:28.453000 'TYPE A\r\n'
 19:38:28.453000 ====> Client disconnect
 19:38:30.953000 select_ws: 0 is readable
 19:38:30.953000 Received DATA (on stdin)
 19:38:30.953000 > 33 bytes data, server => client
 19:38:30.953000 '200 I modify TYPE as you wanted\r\n'
 19:38:30.953000 *** We are disconnected
=== End of file ftp_sockctrl.log
=== Start of file ftp_sockdata.log
 19:38:12.093000 Running IPv4 version
 19:38:18.000000 Listening on port 2441
 19:38:18.000000 Wrote pid 3888 to ./.ftp_sockdata.pid
 19:38:18.000000 select_ws: 0 is readable
 19:38:18.000000 Received PING (on stdin)
 19:38:18.000000 select_ws: 0 is readable
 19:38:18.000000 Received PORT (on stdin)
 19:38:22.703000 select_ws: 160 is readable
 19:38:22.703000 ====> Client connect
 19:38:27.453000 select_ws: 168 is readable
 19:38:27.453000 select_ws: 168 is excepted
 19:38:27.453000 ====> Client disconnect
=== End of file ftp_sockdata.log
=== Start of file server.input
 USER anonymous
 PASS ftp@example.com
 PWD
 CWD 1501
 EPSV
 TYPE A
=== End of file server.input
=== Start of file stderr1501
 URL: ftp://127.0.0.1:8992/1501/
 * STATE: INIT => CONNECT handle 0x7dc000; line 1361 (connection #-5000)
 * Added connection 0. The cache now contains 1 members
 *   Trying 127.0.0.1...
 * TCP_NODELAY set
 * STATE: CONNECT => WAITCONNECT handle 0x7dc000; line 1418 (connection #0)
 * Connected to 127.0.0.1 (127.0.0.1) port 8992 (#0)
 * STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x7dc000; line 1537 (connection #0)
 * Marked for [keep alive]: FTP default
 * FTP 0x7d3970 (line 3112) state change from STOP to WAIT220
 * STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x7dc000; line 1552 (connection #0)
 ping
 < 220-        _   _ ____  _     
 < 220-    ___| | | |  _ \| |    
 < 220-   / __| | | | |_) | |    
 < 220-  | (__| |_| |  _ {| |___ 
 < 220    \___|\___/|_| \_\_____|
 > USER anonymous
 * FTP 0x7d3970 (line 797) state change from WAIT220 to USER
 pong = 0
 ping
 < 331 We are happy you popped in
 > PASS ftp@example.com
 * FTP 0x7d3970 (line 2540) state change from USER to PASS
 pong = 0
 ping
 < 230 Welcome you silly person
 > PWD
 * FTP 0x7d3970 (line 809) state change from PASS to PWD
 pong = 0
 ping
 < 257 "/" is current directory
 * Entry path is '/'
 * FTP 0x7d3970 (line 2864) state change from PWD to STOP
 * protocol connect phase DONE
 * STATE: PROTOCONNECT => DO handle 0x7dc000; line 1573 (connection #0)
 * DO phase starts
 > CWD 1501
 * FTP 0x7d3970 (line 905) state change from STOP to CWD
 * ftp_perform ends with SECONDARY: 0
 * STATE: DO => DOING handle 0x7dc000; line 1622 (connection #0)
 pong = 0
 ping
 < 250 CWD command successful.
 > EPSV
 * FTP 0x7d3970 (line 1340) state change from CWD to PASV
 * Connect data stream passively
 pong = 0
...
 ping
 < 229 Entering Passive Mode (|||2441|)
 *   Trying 127.0.0.1...
 * TCP_NODELAY set
 * Connecting to 127.0.0.1 (127.0.0.1) port 2441
 * FTP 0x7d3970 (line 1997) state change from PASV to STOP
 * DO phase is complete2
 * STATE: DOING => DO_MORE handle 0x7dc000; line 1706 (connection #0)
 * Connected to 127.0.0.1 (127.0.0.1) port 8992 (#0)
 * DO-MORE connected phase starts
 > TYPE A
 * FTP 0x7d3970 (line 3438) state change from STOP to LIST_TYPE
 pong = 9453
 * multi_done
 * Marked for [closure]: FTP ended with bad error code
 * Closing connection 0
 * The cache now contains 0 members
=== End of file stderr1501

@danielgustafsson
Copy link
Member

My only concern with this PR is that the mkfiles are generically named, yet not easily recognized as Plan9 files unless one knows the Plan9 build. We typically have such files suffixed with the platform, for example lib/Makefile.netware, is it possible to name these with a .plan9 suffix without it complicating the Plan9 building too badly?

@lufia
Copy link
Contributor Author

lufia commented Apr 5, 2019

@danielgustafsson I can rename mkfile to mkfile.plan9. Would I require to rename mkfile.inc too?

To install curl and libcurl.a, Plan 9 users will just type mk -f mkfile.plan9 install after installing requirement libraries.

@danielgustafsson
Copy link
Member

@danielgustafsson I can rename mkfile to mkfile.plan9. Would I require to rename mkfile.inc too?

I think it would be a good idea if these files are more easily distinguishable as Plan9 files, kind of like how we have winbuild/ for the Windows buildsystem.

@lufia
Copy link
Contributor Author

lufia commented Apr 6, 2019

@danielgustafsson I did it!

@danielgustafsson
Copy link
Member

@danielgustafsson I did it!

Thanks! I plan on reviewing and testing this either today or tomorrow.

@bagder
Copy link
Member

bagder commented May 11, 2019

@danielgustafsson this seems to have got stuck here. Was it something that stopped you or just lack of time and energy? Not implying anything bad, I'm just assessing the state of this PR and what to do next with it!

@lufia
Copy link
Contributor Author

lufia commented Jul 27, 2019

@danielgustafsson @bagder Is there any update on this?

@bagder
Copy link
Member

bagder commented Jul 28, 2019

I think this can be merged.

What's the purpose of include/mkfile ? You nicely put all other things in the plan9 subdir, shouldn't that also be there?

You didn't add any of the new files to to the dist, so doing 'make dist' will create a dist without most of the plan9 files - I presume that wasn't intended!

@lufia
Copy link
Contributor Author

lufia commented Jul 30, 2019

@bagder Sorry, I had forgotten moving include/mkfile into plan9/ directory.
I've fixed it, and to add Plan 9 files to dist, I've updated the recipe.
Thank you for your advice.

@bagder
Copy link
Member

bagder commented Jul 30, 2019

Thanks a lot for your hard work on this!

@bagder bagder closed this in 84aba18 Jul 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants