Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

UNIX_FD in practice?

オープン
#107 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
32/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ruby

調査の方向性

Start at the DBus::Object NewConnection declaration and the RegisterProfile call shown in the issue, then reproduce the Bluetooth connection while watching the dbus monitor output. Trace why the method call containing a file descriptor is rejected before the callback runs; done means the callback receives the descriptor without the NotSupported error.

索引モデルが issue の本文から書いたものです。

説明

Heya!

I'm using ruby-dbus to attempt a Bluetooth serial profile callback, and I'm
running into a "Tried to send message with Unix file descriptors to a client that
doesn't support that." error message from dbus.

It's entirely possible I'm defining the callback incorrectly, but I think that's
correct. Example profile definition and registration (as defined here)

class SerialConnection < DBus::Object
    dbus_interface( 'org.bluez.Profile1' ) do

        dbus_method( :Release ) do
            puts "... release"
            nil
        end

        dbus_method( :NewConnection, "in device:o, in fd:h, in fd_props:a{sv}" ) do |device, fd, fd_props|
            puts "... incoming connection %p %p %p" % [ device, fd, fd_props ]
                    # sock = Socket.for_fd( fd )
                    # ...
            nil
        end

        dbus_method( :RequestDisconnection, "in device:o" ) do |device|
            puts "... disconnect"
            nil
        end
    end
end


serial_conn = SerialConnection.new( '/serial/connection' )

bluez_service = DBus::SystemBus.instance.service( 'org.bluez' ).introspect
bluez_profile_manager = bluez_service[ '/org/bluez' ][ 'org.bluez.ProfileManager1' ]

bluez_profile_manager.RegisterProfile( serial_conn.path, '1101', {
    'Name'    => 'Serial Port',
    'Role'    => 'server',
    'RequireAuthorization' => false,
    'Channel' => DBus.variant( 'q', 22 )
});

# ... enter dbus main loop here

When an RFCOMM compatible client connects, the dbus monitor shows it disconnect
immediately (the callback doesn't fire at all).

signal time=1649451498.238931 sender=:1.2 -> destination=(null destination) serial=870 path=/org/bluez/hci0/dev_0C_8D_CA_99_D7_E7; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.bluez.Device1"
   array [
      dict entry(
         string "Connected"
         variant             boolean true
      )
   ]
   array [
   ]
method call time=1649451498.709483 sender=:1.2 -> destination=:1.73 serial=871 path=/serial/connection; interface=org.bluez.Profile1; member=NewConnection
   object path "/org/bluez/hci0/dev_0C_8D_CA_99_D7_E7"
   file descriptor
         inode: 72836         type: socket
         address family: bluetooth
   array [
   ]
error time=1649451498.709751 sender=org.freedesktop.DBus -> destination=:1.2 error_name=org.freedesktop.DBus.Error.NotSupported reply_serial=871
   string "Tried to send message with Unix file descriptorsto a client that doesn't support that."
signal time=1649451503.316416 sender=:1.2 -> destination=(null destination) serial=872 path=/org/bluez/hci0/dev_0C_8D_CA_99_D7_E7; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.bluez.Device1"
   array [
      dict entry(
         string "Connected"
         variant             boolean false
      )
   ]
   array [
   ]

It seems like it's complaining specifically about the second argument to the
NewConnection method.

   file descriptor
         inode: 72836         type: socket
         address family: bluetooth

Is there a different path I should be taking to tackle this?

Thanks for any insight provided.

主要言語
Ruby
スター
174
フォーク
51
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mvidner/ruby-dbus のほかの issue

mvidner/ruby-dbus の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。