ほんとのこと知りたいだけなのに。

夏休みはもうおわり。

続:Windows で trival-ssh が出来ない件

前回UIOP のところで止っていたのでその続き。

ASDF をローカルに持ってきて quicklisp でロード対象にする。

ASDF こっから clone する。

(ql:uninstall 'asdf)ASDF 自体をアンインストールする。

asdf.asd のショーットカットを作成して自分の好きなところに配置して (ql:quickload :asdf) を実行してインストール(っていうの?)する。

場所を確認して成功を確認。

CL-USER> (ql:where-is-system :asdf)
#P"C:/Users/yanqi/prj/asdf/"

バージョンは 3.2.1 でした。

CL-USER> (asdf:asdf-version)
"3.2.1"

UIOPのバージョン(かな?)も同じ模様。

CL-USER> uiop:*uiop-version*
"3.2.1"

run-program を眺めてみる。

(defun run-program (command &rest keys
                    &key ignore-error-status (force-shell nil force-shell-suppliedp)
                      input (if-input-does-not-exist :error)
                      output (if-output-exists :supersede)
                      error-output (if-error-output-exists :supersede)
                      (element-type #-clozure *default-stream-element-type* #+clozure 'character)
                      (external-format *utf-8-external-format*)
                    &allow-other-keys)
  (declare (ignorable input output error-output if-input-does-not-exist if-output-exists
                      if-error-output-exists element-type external-format ignore-error-status))
  (apply (if (or force-shell
                 (and (stringp command)
                      (or (not force-shell-suppliedp))))
             '%use-system '%use-launch-program)
         command keys))

UIOP/RUN-PROGRAM::%USE-LAUNCH-PROGRAM をコールしている模様。

%USE-LAUNCH-PROGRAM を眺めてみる。

うーん長いね。。。。

(defun %use-launch-program (command &rest keys
                            &key input output error-output ignore-error-status &allow-other-keys)
  (when (member :stream (list input output error-output))
    (parameter-error "~S: ~S is not allowed as synchronous I/O redirection argument"
                     'run-program :stream))
  (let* ((active-input-p (%active-io-specifier-p input))
         (active-output-p (%active-io-specifier-p output))
         (active-error-output-p (%active-io-specifier-p error-output))
         (activity
           (cond
             (active-output-p :output)
             (active-input-p :input)
             (active-error-output-p :error-output)
             (t nil)))
         output-result error-output-result exit-code process-info)
    (with-program-output ((reduced-output output-activity)
                          output :keys keys :setf output-result
                                 :stream-easy-p t :active (eq activity :output))
      (with-program-error-output ((reduced-error-output error-output-activity)
                                  error-output :keys keys :setf error-output-result
                                               :stream-easy-p t :active (eq activity :error-output))
        (with-program-input ((reduced-input input-activity)
                             input :keys keys
                                   :stream-easy-p t :active (eq activity :input))
          (setf process-info
                (apply 'launch-program command
                       :input reduced-input :output reduced-output
                       :error-output (if (eq error-output :output) :output reduced-error-output)
                       keys))
          (labels ((get-stream (stream-name &optional fallbackp)
                     (or (slot-value process-info stream-name)
                         (when fallbackp
                           (slot-value process-info 'bidir-stream))))
                   (run-activity (activity stream-name &optional fallbackp)
                     (if-let (stream (get-stream stream-name fallbackp))
                       (funcall activity stream)
                       (error 'subprocess-error
                              :code `(:missing ,stream-name)
                              :command command :process process-info))))
            (unwind-protect
                 (ecase activity
                   ((nil))
                   (:input (run-activity input-activity 'input-stream t))
                   (:output (run-activity output-activity 'output-stream t))
                   (:error-output (run-activity error-output-activity 'error-output-stream)))
              (close-streams process-info)
              (setf exit-code (wait-process process-info)))))))
    (%check-result exit-code
                   :command command :process process-info
                   :ignore-error-status ignore-error-status)
    (values output-result error-output-result exit-code)))

一旦動かしてみる。

読むのが面倒なので一度 (ql:quickload :trivial-ssh) してみる。。。。。っと通りました。。。。

CL-USER> (ql:quickload :trivial-ssh)
To load "trivial-ssh":
  Load 1 ASDF system:
    trivial-ssh
; Loading "trivial-ssh"

(:TRIVIAL-SSH)

おしまい。

なんかバージョンが古いだけ問題っぽいですね。

とりあえずイケたので、これはこれで良しとします。

次回でバージョンを確認しようかな。

業務系システムの保守/運用 で仙人が誕生する理由

この業界に戻ってそろそろ一年が経過しようとしている。

どこの現場もかわらないなという印象を受けている。

その中でどこの現場にもいるであろう「仙人」が生成される仕組みをメモしておく。

原因的なところ

  1. 難しいことをこなすIT技術的な能力が乏しい。
  2. 知識を体系化する能力がない。
  3. 納期が厳しい。
  4. クライアントが IT をカカオと同じ程度にしか考えていない。

誕生する仕組み

  1. 資料/仕組みを作る時間がない。
    • 業務が忙しい。
    • カウボーイ気質。
  2. 知識/経験重視になる。
  3. 資料を作っても陳腐化する。
    • 歯を食い縛って耐えている人、外から呼ばれた人が一念発起で作成したりする。
    • 作成された資料を誰もメンテしないし、使われない。「知識/経験重視」なので
    • いろんな人がそれぞれの思いで作成し多様化する。
  4. 生きのこる人と、涅槃に入られるお方に分かれる。
  5. 生きのこった人はその道を極めることになる。
  6. そして仙人が誕生する。

  7. 仙人を頂点とした世界のヒエラルキーは維持される。

  8. 仙人は仙人でいつづける。
  9. そして世界は仙人中心にまわる。

仙人誕生後の世界

  1. 仙人は自身がどうやって仙人になったのか説明できない。
    • なろうとしてなったのではなく、知識/経験を蓄積したけだから。
  2. 人に教育出来ない。
    • 「知識/経験を蓄積したけ」なのでそれは時間で解決するしかない。
    • そもそもそれを理解できていない。
    • 理解する能力がない/欠如している/成長過程において育成されていない。
  3. 「出来ない」を個人の精神論でしか語れない。
  4. 「説法」中心になる。
    • 説明出来る自分に酔いしれるようになる。
    • そこでの他者の存在が薄れていく。
    • 理解できない他社が「馬鹿」に見え初める。

仙人のメリット

  1. 案外コストが安い。のではないか。
    • 教育/仕組み化のコストを削減出来る。
    • どのみに大した事していないし。
    • 人一人を飼いならしておけば良いので。
  2. クライアントからの窓口が一本化される。
  3. 終身雇用制にぴったり。なので日本らしい。

仙人のデメリット

  1. 仙人の能力以上の組織にはならない。
  2. 仙人は多忙なので自身の能力開発がされない。
  3. 世代交代が難しい。

おわり

仙人になる人は頭のキレる賢い人が多いとおもう。 なので誰でも仙人になれるわけではないと思います。

ただ、そういう人はいろんな物を自分に寄せ、短いスパンでの利益を追い求める傾向が強いように感じます。(自身の評価を高めるのに効率が良い方法だと思います)

このサイクルは業務系システムの保守/運用の現場だけではなく、そこら中に溢れていると思う。 これは逃れられない事かもしれない。

けれどITはこれらを解決するための物ではないか。と強く思う。

Windows で trival-ssh が出来ない件

(ql:quickload :trivial-ssh) すると [package libssh2]. で停止する。

表示されるコマンドを msys2 のターミナルで叩くと成功する模様

yanqi@ MINGW64 ~/.emacs.d/dist/emacs                                                                                                                              
$ gcc -o "C:\Users\yanqi\AppData\Local\common-lisp\sbcl-1.3.15-win-x64\C\Users\yanqi\prj\trivial-ssh\libssh2\libssh2-libc-cffi__grovel-tmpGHU3ALSV.obj" -c -m64 -IC:/Users/y 
anqi/prj/cffi/ "C:\Users\yanqi\AppData\Local\common-lisp\sbcl-1.3.15-win-x64\C\Users\yanqi\prj\trivial-ssh\libssh2\libssh2-libc-cffi__grovel.c"                              
                                                                                                                                                                             
yanqi@ MINGW64 ~/.emacs.d/dist/emacs                                                                                                                              
$ echo $?                                                                                                                                                                    
0                                                                                                                                                                            

yanqi@ MINGW64 ~/.emacs.d/dist/emacs
$ ls -la /c/Users/yanqi/AppData/Local/common-lisp/sbcl-1.3.15-win-x64/C/Users/yanqi/prj/trivial-ssh/libssh2/libssh2-libc-cffi__grovel-tmpGHU3ALSV.obj
-rw-r--r-- 1 PC568+yanqi PC568+yanqi 5537 9月   2 14:52 /c/Users/yanqi/AppData/Local/common-lisp/sbcl-1.3.15-win-x64/C/Users/yanqi/prj/trivial-ssh/libssh2/libssh2-libc-cffi_ _grovel-tmpGHU3ALSV.obj

コードを眺めてみる。

trivial-ssh-libssh2.asd(cffi-grovel:grovel-file "libssh2-libc-cffi") で libssh2 をコンパイルしているがここで止っている様子

cffi-grovel:grovel-file

cffi-grovel:grovel-file はクラスでした。

(defclass grovel-file (process-op-input cc-flags-mixin)
  ()
  (:default-initargs
   :generated-lisp-file-type "processed-grovel-file")
  (:documentation
   "This ASDF component represents an input file that is processed
    by PROCESS-GROVEL-FILE."))

grovel.lisp

grovel.lispprocess-grovel-file で帰ってこない模様。

(cc-compile o-file inputs)
;;; *PACKAGE* is rebound so that the IN-PACKAGE form can set it during
;;; *the extent of a given grovel file.
(defun process-grovel-file (input-file &optional (output-defaults input-file))
  (with-standard-io-syntax
    (let* ((c-file (generate-c-file input-file output-defaults))
           (o-file (make-o-file-name c-file))
           (exe-file (make-exe-file-name c-file))
           (lisp-file (tmp-lisp-file-name c-file))
           (inputs (list (cc-include-grovel-argument) c-file)))
      (handler-case
          (progn
            ;; at least MKCL wants to separate compile and link
            (cc-compile o-file inputs)
            (link-executable exe-file (list o-file)))
        (error (e)
          (grovel-error "~a" e)))
      (invoke exe-file lisp-file)
      lisp-file)))

cc-compile

cc-compile は コンパイルしているだけ。

(defun cc-compile (output-file inputs)
  (apply 'invoke-builder (list *cc* "-o") output-file
         "-c" (append *cc-flags* #-windows '("-fPIC") inputs)))

invoke-builder

(defun invoke-builder (builder output-file &rest args)
  "Invoke the C Compiler with given OUTPUT-FILE and arguments ARGS"
  (with-temporary-output (output-file)
    (apply 'invoke `(,@builder ,output-file ,@args))))

invoke

ここの以下の場所で帰ってこない。

(run-program cmd :output :interactive :error-output :interactive)

(defun invoke (command &rest args)
  (when (pathnamep command)
    (setf command (native-namestring command))
    #+os-unix
    (unless (absolute-pathname-p command)
      (setf command (strcat "./" command))))
  (let ((cmd (cons command (mapcar 'program-argument args))))
    (safe-format! *debug-io* "; ~A~%" (escape-command cmd))
    (dolist (d cmd)
      (print d))
    (run-program cmd :output :interactive :error-output :interactive)))

run-program

UIOP/RUN-PROGRAM:RUN-PROGRAM な様子。

UIOP か。。。

UIOP 見るかぁ

で、時間がないので今度にしよう。